+++ /dev/null
-!Makefile
-tet_captured
-results-desktop
-results-target
-results
-rules.mk
-dali.info
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+PROJECT(tct_coreapi_utc)
+
+INCLUDE(FindPkgConfig)
+SET(BIN_DIR "/opt/usr/bin")
+
+INCLUDE_DIRECTORIES(
+ src/common
+)
+
+ADD_SUBDIRECTORY(src)
--- /dev/null
+!Makefile
+tet_captured
+results-desktop
+results-target
+results
+rules.mk
+dali.info
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+#!/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 <<EOF > coverage.mk
+LDFLAGS += --coverage
+EOF
+ ;;
+ scratchbox)
+ . _export_env.sh
+ cat <<EOF > coverage.mk
+LDFLAGS +=
+EOF
+ ;;
+ sbs)
+ . _export_sbs.sh
+ cat <<EOF > 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
+
+
--- /dev/null
+#!/bin/bash
+
+./build.sh -v $*
--- /dev/null
+LDFLAGS += --coverage
--- /dev/null
+#!/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`
+)
+
+
--- /dev/null
+#
+# Copyright (c) 2014 Samsung Electronics Co., Ltd.
+#
+# Licensed under the Flora License, Version 1.0 (the License);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://floralicense.org/license/
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an AS IS BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+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
--- /dev/null
+../dali-test-suite/tc-gen.sh
\ No newline at end of file
--- /dev/null
+utc-Dali-TextInput
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-TextInput \
--- /dev/null
+/dali-internal-test-suite/text-input/utc-Dali-TextInput
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali/integration-api/events/key-event-integ.h>
+
+// Internal includes
+#include <dali-toolkit/internal/controls/text-input/text-input-impl.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( 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<Toolkit::Internal::TextInput&>( 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);
+}
--- /dev/null
+utc-Dali-TextView
+utc-Dali-TextView-HelperAndDebug
+utc-Dali-TextView-Processor
+utc-Dali-TextView-Processor-Types
+utc-Dali-TextView-Relayout-Utilities
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+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
--- /dev/null
+/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
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-impl.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h>
+
+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 te<font size='30'>xt text te</font>xt text\n"
+ "text t<font size='30'>ext טקסט טקסט te</font>xt\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( "t<font size='30'>ext text te</font>xt text text\n"
+ "text text טקסט טקסט text\n"
+ "text text te<font size='30'>xt text</font> text\n"
+ "\n" ),
+ 76,
+ 4,
+ 0,
+ 0,
+ 0
+ },
+ {
+ std::string( "Test position 73. (the last \\n)" ),
+ std::string( "text te<font size='30'>xt text text </font>text\n"
+ "text text טק<font size='30'>סט טקס</font>ט 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 te<font size='30'>xt text text text\n</font>"
+ "text text טק<font size='30'>סט טקסט </font>text\n"
+ "text te<font size='30'>xt text text</font> 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 te<font size='30'>xt text text text\n</font>"
+ "text text טק<font size='30'>סט טקסט </font>text\n"
+ "text te<font size='30'>xt text text</font> text\n"
+ "\n" ),
+ 33,
+ 1,
+ 0,
+ 2,
+ 3
+ },
+ {
+ std::string( "Test position 43. (last hebrew character)" ),
+ std::string( "text te<font size='30'>xt text text text\n</font>"
+ "text text טק<font size='30'>סט טקסט </font>text\n"
+ "text te<font size='30'>xt text text</font> 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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-types.h>
+
+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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/text-processor.h>
+
+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<MarkupProcessor::StyledTextArray> 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<MarkupProcessor::StyledTextArray> 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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
+
+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 <font size='14'>world</font>", // 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 <font size='14'>wo</font>rld hell<font size='14'>o world</font>", // 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 <font size='14'>wo</font>rld hell<font size='14'>o world</font>", // 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.",
+ "Hell<font size='14'>o</font> 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 <font size='14'>wo</font>rld <font size='16'>hello world</font>", // 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 <font size='14'>world</font>", // 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<font size='14'> world</font>", // 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 );
+
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-line-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
+#include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
+
+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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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( "Hel<font size='10'>lo wo</font>rld!\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( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 0,
+ std::string( "" ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ },
+ {
+ std::string( "Split word, position 8." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 8,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ std::string( "" ),
+ },
+ {
+ std::string( "Split word, position 2." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 2,
+ std::string( "<font size='10'>He</font>" ),
+ std::string( "<font size='12'>ll</font><font size='10'>oooo</font>" ),
+ },
+ {
+ std::string( "Split word, position 3." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 3,
+ std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
+ std::string( "<font size='12'>l</font><font size='10'>oooo</font>" ),
+ },
+ {
+ std::string( "Split word, position 4." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 4,
+ std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
+ std::string( "<font size='10'>oooo</font>" ),
+ },
+ };
+ 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("<b>\nh</b>"),
+ 0.f,
+ std::string("Hello world<b>\nh</b>ello 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 <font size='30'>world\nhello</font> world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='30'>wd\nhello</font> 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 <font size='30'>w<font size='20'>orl</font>d\nhello</font> world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='30'>wd\nhello</font> 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 <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='30'>w</font><font size='10'>d\nhello</font> world" )
+ },
+ // * Remove whole word (merge words)
+ {
+ std::string( "Remove within the same word, whole word (merge words)" ),
+ Remove,
+ std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
+ 5,
+ 1,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello<font size='30'>w</font>orl<font size='10'>d\nhello</font> 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 <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
+ 6,
+ 5,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='10'>\nhello</font> world" )
+ },
+ // * Remove whole word (merge lines)
+ {
+ std::string( "Remove within the same word, whole word (merge lines)" ),
+ Remove,
+ std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
+ 11,
+ 1,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='30'>w</font>orl<font size='10'>dhello</font> 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 <font color='green'>world</font>" ),
+ 0,
+ 7,
+ std::string( "<font color='red'>Hello w</font>" ),
+ 0.f,
+ std::string( "<font color='red'>Hello w</font><font color='green'>orld</font>" )
+ },
+ {
+ std::string( "Replace style from the middle of the text to the end." ),
+ Replace,
+ std::string( "Touch me\nhello" ),
+ 6,
+ 8,
+ std::string( "<b>me\nhello</b>" ),
+ 0.f,
+ std::string( "Touch <b>me\nhello</b>" )
+ },
+ {
+ 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( "<b>me\nhello</b>" ),
+ 0.f,
+ std::string( "Touch <b>me\nhello</b>\nworld" )
+ },
+ {
+ std::string( "Replace style from the middle of the text 1." ),
+ Replace,
+ std::string( "Touch me\nhello\nworld" ),
+ 6,
+ 8,
+ std::string( "<b>me\nhello</b>" ),
+ 0.f,
+ std::string( "Touch <b>me\nhello</b>\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( "<b>me\nhello\n</b>" ),
+ 0.f,
+ std::string( "Touch <b>me\nhello\n</b>world" )
+ },
+ };
+ 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( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
+ 0,
+ 0,
+ std::string( "" ),
+ std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 2, position 8." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 2,
+ 7,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ std::string( "" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 2." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 0,
+ 2,
+ std::string( "<font size='10'>He</font>" ),
+ std::string( "<font size='12'>ll</font><font size='10'>oooo wooorld</font>" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 3." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 0,
+ 3,
+ std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
+ std::string( "<font size='12'>l</font><font size='10'>oooo wooorld</font>" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 4." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 0,
+ 4,
+ std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
+ std::string( "<font size='10'>oooo wooorld</font>" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 1, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 1,
+ 0,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ std::string( "<font size='10'> wooorld</font>" ),
+ },
+ };
+ 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( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 0,
+ 0,
+ 0,
+ 3.f,
+ std::string( "" ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ },
+ {
+ std::string( "Split line, groupPosition 2, wordPosition 2, position 4." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 2,
+ 2,
+ 4,
+ 0.f,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ std::string( "" ),
+ },
+ /* TODO check when RTL is working.
+ {
+ std::string( "Split line, groupPosition 1, wordPosition 2, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 1,
+ 2,
+ 0,
+ 0.f,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום" ),
+ std::string( " עולם text text" ),
+ },
+ {
+ std::string( "Split line, groupPosition 1, wordPosition 0, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 1,
+ 0,
+ 0,
+ 0.f,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> " ),
+ std::string( "שלום עולם text text" ),
+ },
+ */
+ {
+ std::string( "Split line, groupPosition 2, wordPosition 0, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 2,
+ 0,
+ 0,
+ 6.f,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם " ),
+ 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( "<font size='10>Hel</font>" ),
+ std::string( "<font size='20'>lo</font>" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>lo</font>" )
+ },
+ };
+ 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( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 1,
+ 2,
+ std::string( "<font size='10'>H</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ },
+ {
+ std::string( "Delete starting in one group of characters and finishing in a different one. No merge of groups." ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 2,
+ 3,
+ std::string( "<font size='10'>He</font><font size='20'>Wo</font><font size='30'>rld</font>" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Starting just after a different one." ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 7,
+ 2,
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>d</font>" ),
+ },
+ {
+ std::string( "Delete whole group of characters. No merge" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 3,
+ 4,
+ std::string( "<font size='10'>Hel</font><font size='30'>rld</font>" ),
+ },
+ {
+ std::string( "Delete whole group of characters and part of the adjacent ones. No merge" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 2,
+ 6,
+ std::string( "<font size='10'>He</font><font size='30'>ld</font>" ),
+ },
+ {
+ std::string( "Delete whole group of characters. Merge" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
+ 3,
+ 4,
+ std::string( "<font size='10'>Helrld</font>" ),
+ },
+ {
+ std::string( "Delete whole group of characters and part of the adjacent ones. Merge" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
+ 2,
+ 6,
+ std::string( "<font size='10'>Held</font>" ),
+ },
+ };
+ 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( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
+ 1,
+ 4,
+ std::string( "<font size='10'>Hel</font><font size='20'>lo</font><font size='30'> world</font>" ),
+ },
+ {
+ std::string( "Delete words up to the end" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
+ 5,
+ 2,
+ std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello</font>" ),
+ },
+ {
+ 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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+// 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);
+ }
+}
+
--- /dev/null
+utc-Dali-ScrollViewEffect
--- /dev/null
+utc-Dali-Alignment
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-Alignment \
--- /dev/null
+/dali-test-suite/alignment/utc-Dali-Alignment
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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);
+}
--- /dev/null
+utc-Dali-BubbleEmitter
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-BubbleEmitter \
--- /dev/null
+/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+utc-Dali-Builder
+utc-Dali-JsonParser
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ Dali/utc-Dali-Builder \
+ Dali/utc-Dali-JsonParser \
--- /dev/null
+/dali-test-suite/builder/utc-Dali-Builder
+/dali-test-suite/builder/utc-Dali-JsonParser
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/builder/builder.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+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<float>() );
+
+ v = camera.GetProperty( camera.GetPropertyIndex("aspect-ratio") );
+ DALI_TEST_CHECK( 5.0f == v.Get<float>() );
+
+ handle = builder.CreateFromStyle("basic-text");
+ TextActor textActor = TextActor::DownCast(handle);
+
+ v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") );
+
+ DALI_TEST_CHECK( 0.2f == v.Get<float>() );
+
+ // test ApplyStyle another
+ builder.ApplyStyle("theme2-text", textActor);
+
+ v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") );
+ DALI_TEST_CHECK( 0.8f == v.Get<float>() );
+
+}
+
+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" );
+
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/builder/json-parser.h>
+
+#include <dali-toolkit-test-suite-utils.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];
+}
+
+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<int>(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);
+}
--- /dev/null
+utc-Dali-CheckBoxButton
+utc-Dali-PushButton
+utc-Dali-Button
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-CheckBoxButton \
+ utc-Dali-PushButton \
+ utc-Dali-Button \
--- /dev/null
+/dali-test-suite/buttons/utc-Dali-CheckBoxButton
+/dali-test-suite/buttons/utc-Dali-PushButton
+/dali-test-suite/buttons/utc-Dali-Button
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
+#include <dali-toolkit/public-api/controls/buttons/push-button.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<CheckBoxButton&>( 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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/public-api/controls/buttons/push-button.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit/public-api/controls/text-view/text-view.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali-toolkit/internal/controls/buttons/button-impl.h>
+
+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<PushButton&>( 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<TETButton, Internal::TETButton>(handle);
+}
+
+TETButton::PressedSignalV2& TETButton::PressedSignal()
+{
+ TETButton button( *this );
+ DALI_ASSERT_ALWAYS( button );
+
+ Dali::RefObject& handle = button.GetImplementation();
+
+ return static_cast<Toolkit::Internal::TETButton&>( handle ).PressedSignal();
+}
+
+TETButton::TETButton( Internal::TETButton& implementation )
+: Button( implementation )
+{}
+
+TETButton::TETButton( Dali::Internal::CustomActor* internal )
+: Button( internal )
+{
+ VerifyCustomActorPointer<Internal::TETButton>(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 );
+ }
+}
--- /dev/null
+utc-Dali-Cluster
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-Cluster \
--- /dev/null
+/dali-test-suite/cluster/utc-Dali-Cluster
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+utc-Dali-ControlImpl
+utc-Dali-Control
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
+#define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+
+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<DummyControl, DummyControlImpl>(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),
+ styleChangeCalled(false),
+ pinchCalled(false),
+ panCalled(false),
+ tapCalled(false),
+ longPressCalled(false),
+ stageConnectionCalled(false),
+ stageDisconnectionCalled(false),
+ childAddCalled(false),
+ childRemoveCalled(false),
+ sizeSetCalled(false),
+ sizeAnimationCalled(false),
+ touchEventCalled(false),
+ mouseWheelEventCalled(false),
+ keyEventCalled(false),
+ keyInputFocusGained(false),
+ keyInputFocusLost(false)
+ {
+ }
+
+ virtual ~DummyControlImplOverride() { }
+
+private: // From ControlImpl
+
+ virtual void OnInitialize() { initializeCalled = true; }
+ virtual void OnStyleChange(StyleChange change) { styleChangeCalled = 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 styleChangeCalled;
+ bool pinchCalled;
+ bool panCalled;
+ bool tapCalled;
+ bool longPressCalled;
+ bool stageConnectionCalled;
+ bool stageDisconnectionCalled;
+ bool childAddCalled;
+ bool childRemoveCalled;
+ bool sizeSetCalled;
+ bool sizeAnimationCalled;
+ bool touchEventCalled;
+ bool mouseWheelEventCalled;
+ bool keyEventCalled;
+ bool keyInputFocusGained;
+ bool keyInputFocusLost;
+};
+
+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<DummyControlImpl>(internal);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
--- /dev/null
+TARGETS += \
+ utc-Dali-ControlImpl \
+ utc-Dali-Control \
--- /dev/null
+/dali-test-suite/control/utc-Dali-ControlImpl
+/dali-test-suite/control/utc-Dali-Control
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+#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;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/long-press-gesture-event.h>
+#include <dali/integration-api/events/pinch-gesture-event.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali/integration-api/events/tap-gesture-event.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+#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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImplOverride&>(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<DummyControlImpl&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ dummyImpl.OnAccessibilityValueChange( true );
+ dummyImpl.IsKeyboardNavigationSupported();
+ dummyImpl.IsKeyboardFocusGroup();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
--- /dev/null
+utc-Dali-DefaultControls
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-DefaultControls \
--- /dev/null
+/dali-test-suite/default-controls/utc-Dali-DefaultControls
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/controls/tool-bar/tool-bar.h>
+#include <dali-toolkit/public-api/controls/view/view.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit/public-api/controls/default-controls/push-button-factory.h>
+#include <dali-toolkit/public-api/controls/default-controls/check-button-factory.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+utc-Dali-FocusManager
+utc-Dali-KeyInputFocusManager
+utc-Dali-KeyboardFocusManager
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-FocusManager \
+ utc-Dali-KeyInputFocusManager \
+ utc-Dali-KeyboardFocusManager
--- /dev/null
+/dali-test-suite/focus-manager/utc-Dali-FocusManager
+/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager
+/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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);
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali/integration-api/events/key-event-integ.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali/integration-api/events/key-event-integ.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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();
+}
--- /dev/null
+utc-Dali-ItemView
+utc-Dali-ItemLayout
+utc-Dali-GridLayout
+utc-Dali-DepthLayout
+utc-Dali-SpiralLayout
+utc-Dali-NavigationLayout
+utc-Dali-AlbumLayout
+utc-Dali-RollLayout
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+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 \
--- /dev/null
+/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
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<Vector3> 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<float> 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<float> 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<Vector2> 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));
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <float.h> // for FLT_MAX
+#include <stdlib.h>
+#include <tet_api.h>
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+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<float>(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<unsigned int> 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);
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+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<float>(numberOfColumns - 1)) / static_cast<float>(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);
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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);
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+#include <tet_api.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<unsigned int> 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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+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<unsigned int> 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);
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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);
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+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<unsigned int> 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);
+}
--- /dev/null
+#
+# Copyright (c) 2014 Samsung Electronics Co., Ltd.
+#
+# Licensed under the Flora License, Version 1.0 (the License);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://floralicense.org/license/
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an AS IS BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+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
--- /dev/null
+utc-Dali-NavigationControl
+utc-Dali-Page
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-NavigationControl \
+ utc-Dali-Page \
--- /dev/null
+/dali-test-suite/navigation-frame/utc-Dali-NavigationControl
+/dali-test-suite/navigation-frame/utc-Dali-Page
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+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() );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
+#include <dali-toolkit/public-api/controls/buttons/push-button.h>
+#include <dali-toolkit/public-api/controls/popup/popup.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+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() );
+}
--- /dev/null
+utc-Dali-PageTurnView
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-PageTurnView \
--- /dev/null
+/dali-test-suite/page-turn-view/utc-Dali-PageTurnView
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <string.h>
+#include <sstream>
+
+#include <dali/public-api/dali-core.h>
+
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<float>( IMAGE_WIDTH ), static_cast<float>(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<frames;i++)
+ {
+ pos += direction; // Move in this direction
+ SendPan(application, Gesture::Continuing, pos);
+ Wait(application);
+ }
+
+ if(toFinish)
+ {
+ pos += direction; // Move in this direction
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application);
+ }
+
+ return pos;
+}
+
+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;
+}
+
+//Functor to test whether PageTurnSignal / PagePanSignal is emitted
+class PageSignalCallback : public Dali::ConnectionTracker
+{
+public:
+
+ PageSignalCallback( bool& signalReceived, PageTurnView& view, unsigned int& pageIndex, bool& isForwards )
+ : mSignalVerified( signalReceived ),
+ mView( view ),
+ mPageIndex( pageIndex ),
+ mIsTurningForwards( isForwards )
+ {
+ }
+
+ // callback to be connected to PageTurnSignal
+ void PageTurnSignalCallback( PageTurnView view, unsigned int pageIndex, bool isTurningForward )
+ {
+ tet_infoline( "Verifying PageTurnedSignal" );
+
+ if( mView == view && mPageIndex == pageIndex && mIsTurningForwards == isTurningForward )
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ // callback to be connected to PagePanSignal
+ void PagePanSignalCallback( PageTurnView view )
+ {
+ tet_infoline( "Verifying PagePannedSignal" );
+
+ if( mView == view )
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ PageTurnView& mView;
+ unsigned int& mPageIndex;
+ bool& mIsTurningForwards;
+
+};
+
+}// 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( UtcDaliPageTurnPortraitViewNew, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPageTurnLandscapeViewNew, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPageTurnViewSetAndGetSpineShadowParameter, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPageTurnViewGoToPageAndGetCurrentPage, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPageTurnViewEnterLeaveEditMode, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPageTurnViewGetHitActor, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPageTurnViewRefresh, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPageTurnViewSignals, 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()
+{
+}
+
+//Implementation of PageFactory for providing page actors to PageTurnView
+class TestPageFactory : public PageFactory
+{
+public:
+
+ TestPageFactory(ToolkitTestApplication& application)
+ : mApplication( application )
+ {
+ mSourceActors.resize(TOTAL_PAGE_NUMBER);
+ mTotalPageNumber = TOTAL_PAGE_NUMBER;
+ }
+
+ /**
+ * Query the number of pages available from the factory.
+ * The maximum available page has an ID of GetNumberOfPages()-1.
+ */
+ virtual unsigned int GetNumberOfPages()
+ {
+ return mTotalPageNumber;
+ }
+
+ /**
+ * Create an image actor to represent a page.
+ * @param[in] pageId The ID of the page to create.
+ * @return An image actor, or an uninitialized pointer if the ID is out of range.
+ */
+ virtual Actor NewPage( unsigned int pageId )
+ {
+ if(!mSourceActors[pageId])
+ {
+ Actor actor = CreateSolidColorImageActor(mApplication, Color::BLUE,IMAGE_WIDTH,IMAGE_HEIGHT);
+ actor.SetName( static_cast<std::ostringstream*>( &(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<Actor> 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);
+}
--- /dev/null
+utc-Dali-Popup
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-Popup \
--- /dev/null
+/dali-test-suite/popup/utc-Dali-Popup
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<numChildren; ++i)
+ {
+ count += DescendentCount(root.GetChildAt(i));
+ }
+
+ return count;
+}
+
+bool HasAncestor(Actor child, Actor ancestor)
+{
+ while(child && child != ancestor)
+ {
+ child = child.GetParent();
+ }
+
+ return (child == ancestor);
+}
+
+}
+
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliPopupNew()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPopupNew");
+
+ // Create the Popup actor
+ Popup popup;
+
+ DALI_TEST_CHECK( !popup );
+
+ popup = Popup::New();
+
+ DALI_TEST_CHECK( popup );
+
+ Popup popup2(popup);
+
+ DALI_TEST_CHECK( popup2 == popup );
+
+ //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 );
+ {
+ Popup popup = Popup::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+}
+
+static void UtcDaliPopupDestructor()
+{
+ ToolkitTestApplication application;
+
+ Popup* popup = new Popup();
+ delete popup;
+
+ DALI_TEST_CHECK( true );
+}
+
+static void UtcDaliPopupDownCast()
+{
+ ToolkitTestApplication application;
+
+ Handle handle = Popup::New();
+
+ Popup popup = Popup::DownCast( handle );
+
+ DALI_TEST_CHECK( popup == handle );
+}
+
+static void UtcDaliPopoupSetProperty()
+{
+ tet_infoline("UtcDaliPopoupSetProperty: ");
+ ToolkitTestApplication application;
+
+ Popup popup = Popup::New();
+
+ //Test properties
+ std::string testString = "Hello World";
+ popup.SetProperty(popup.GetPropertyIndex("title"), testString);
+ DALI_TEST_EQUALS( testString, popup.GetTitle().GetText(), TEST_LOCATION );
+}
+
+
+static void UtcDaliPopupSetBackgroundImage()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetBackgroundImage");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+
+ ImageActor image = CreateSolidColorActor( Color::RED );
+ DALI_TEST_CHECK( !image.GetParent() );
+ popup.SetBackgroundImage(image);
+ DALI_TEST_CHECK( image.GetParent() );
+}
+
+static void UtcDaliPopupSetTitle()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetTitle");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ // Put in show state so it's layer is connected to popup (for ancestor check).
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+
+ TextView titleActor = TextView::New();
+ titleActor.SetText("title");
+
+ DALI_TEST_CHECK( !popup.GetTitle() );
+ popup.SetTitle(titleActor);
+ DALI_TEST_CHECK( popup.GetTitle() == titleActor );
+ DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "title") );
+ // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
+ DALI_TEST_CHECK( HasAncestor(titleActor, popup) );
+
+ TextView titleActor2 = TextView::New();
+ titleActor2.SetText("anothertitle");
+ popup.SetTitle(titleActor2);
+ DALI_TEST_CHECK( popup.GetTitle() != titleActor );
+ DALI_TEST_CHECK( popup.GetTitle() == titleActor2 );
+ DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "anothertitle") );
+ // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
+ DALI_TEST_CHECK( HasAncestor(titleActor2, popup) );
+}
+
+static void UtcDaliPopupSetTitleText()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetTitleText");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ // Put in show state so it's layer is connected to popup (for ancestor check).
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+
+ TextView titleActor = TextView::New();
+ titleActor.SetText("title");
+
+ DALI_TEST_CHECK( !popup.GetTitle() );
+ popup.SetTitle(titleActor);
+ DALI_TEST_CHECK( popup.GetTitle() == titleActor );
+ DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "title") );
+ // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
+ DALI_TEST_CHECK( HasAncestor(titleActor, popup) );
+
+ // this text should replace titleImage actor.
+ popup.SetTitle("newtext");
+ DALI_TEST_CHECK( popup.GetTitle() != titleActor );
+ DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "newtext") );
+ // verify titleActor is no longer inside popup. (been displaced by newtext actor)
+ DALI_TEST_CHECK( !HasAncestor(titleActor, popup) );
+}
+
+static void UtcDaliPopupAddButton()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupAddButton");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ // Put in show state so it's layer is connected to popup (for ancestor check).
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+
+ PushButton button = PushButton::New();
+ DALI_TEST_CHECK( !HasAncestor(button, popup) );
+ popup.AddButton(button);
+ // Hide and then re-show popup to cause button to be rearranged and added to popup.
+ popup.SetState( Popup::POPUP_HIDE, 0.0f );
+ popup.SetState( Popup::POPUP_SHOW, 0.0f );
+ DALI_TEST_CHECK( HasAncestor(button, popup) );
+}
+
+static void UtcDaliPopupSetState()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetState");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+
+ ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
+ popup.SetBackgroundImage(backgroundImage);
+
+ // Showing/Hiding popup, results in all child Actors being
+ // connected/disconnected from the stage.
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+ DALI_TEST_CHECK( backgroundImage.OnStage() );
+ DALI_TEST_EQUALS( Popup::POPUP_SHOW, popup.GetState(), TEST_LOCATION );
+ popup.SetState(Popup::POPUP_HIDE, 0.0f);
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ DALI_TEST_EQUALS( Popup::POPUP_HIDE, popup.GetState(), TEST_LOCATION );
+}
+
+static void UtcDaliPopupSetStateSlow()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetStateSlow");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+
+ ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
+ popup.SetBackgroundImage(backgroundImage);
+
+ // Showing/Hiding popup, results in all child Actors being
+ // connected/disconnected from the stage.
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+ DALI_TEST_CHECK( backgroundImage.OnStage() );
+
+ // Hide slowly
+ popup.SetState(Popup::POPUP_HIDE);
+
+ // Wait for a while (allow animation to complete), and then check state.
+ for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ }
+
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+}
+
+static bool gHidden = false;
+
+static void OnPopupHidden()
+{
+ gHidden = true;
+}
+
+static void UtcDaliPopupShowHide()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupShowHide");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ popup.HiddenSignal().Connect( &OnPopupHidden );
+
+ ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
+ popup.SetBackgroundImage(backgroundImage);
+
+ PushButton button1 = PushButton::New();
+ PushButton button2 = PushButton::New();
+ button1.SetSize(DEFAULT_BUTTON_SIZE);
+ popup.AddButton(button1);
+ button2.SetSize(DEFAULT_BUTTON_SIZE);
+ popup.AddButton(button2);
+
+ // Showing/Hiding popup, results in all child Actors being
+ // connected/disconnected from the stage.
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+
+ // Show
+ // Note: in most popup animation implementations show would result in
+ // popup being onstage immediately following Show(). However we can't
+ // assume for all. e.g. If one creates a animation with a delay.
+ popup.Show();
+
+ // Wait for a while (allow animation to complete), and then check state.
+ for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ }
+
+ DALI_TEST_CHECK( backgroundImage.OnStage() );
+
+ // Hide
+ gHidden = false;
+ popup.Hide();
+
+ // Wait for a while (allow animation to complete), and then check state.
+ for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ }
+
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ DALI_TEST_CHECK( gHidden );
+}
+
+static void UtcDaliPopupShowHideTail()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupShowHideTail");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+
+ popup.HideTail();
+ int withoutTailCount = DescendentCount(popup);
+
+ popup.ShowTail(ParentOrigin::BOTTOM_CENTER);
+ int withTailCount = DescendentCount(popup);
+
+ // There should be more actors if the Tail has been added.
+ DALI_TEST_CHECK( withTailCount > 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);
+}
--- /dev/null
+utc-Dali-ScrollView
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-ScrollView \
+ utc-Dali-ScrollViewEffect \
--- /dev/null
+/dali-test-suite/scroll-view/utc-Dali-ScrollView
+/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<MAX_FRAMES_TO_TEST_OVERSHOOT;i++)
+ {
+ float overshootXValue = scrollView.GetProperty<float>(overshootPropertyX);
+ float overshootYValue = scrollView.GetProperty<float>(overshootPropertyY);
+ if(overshootXValue == 0.0f && overshootYValue == 0.0f)
+ {
+ break;
+ }
+
+ timeToReachOrigin += Wait(application);
+ }
+
+ return static_cast<float>(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<int>(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<int>(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<int>(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<int>(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<int>(scrollView.GetCurrentPage()), 17, TEST_LOCATION );
+ scrollView.SetWrapMode(true);
+ DALI_TEST_EQUALS( static_cast<int>(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;i<CLAMP_GESTURE_FRAMES;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos += CLAMP_TOUCH_MOVEMENT; // Move South-West a little
+ Wait(application);
+
+ if((gLastClampPosition.x == Toolkit::NotClamped) && (gLastClampPosition.y == Toolkit::NotClamped) && (step==CLAMP_STEP_0_CHECK_NOTCLAMPED))
+ {
+ step = CLAMP_STEP_1_CHECK_CLAMPED_WEST;
+ }
+ else if((gLastClampPosition.x == Toolkit::ClampedToMin) && (gLastClampPosition.y == Toolkit::NotClamped) && (step==CLAMP_STEP_1_CHECK_CLAMPED_WEST))
+ {
+ step = CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST;
+ }
+ else if((gLastClampPosition.x == Toolkit::ClampedToMin) && (gLastClampPosition.y == Toolkit::ClampedToMax) && (step==CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST))
+ {
+ step = CLAMP_STEP_3_SUCCESS;
+ }
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application);
+
+ DALI_TEST_CHECK( gOnScrollClampedCalled );
+ DALI_TEST_EQUALS( step, CLAMP_STEP_3_SUCCESS, TEST_LOCATION );
+}
+
+static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true)
+{
+ gOnScrollStartCalled = false;
+ gOnScrollUpdateCalled = false;
+ gOnScrollCompleteCalled = false;
+ gOnSnapStartCalled = false;
+
+ // Now do a pan starting from (start) and heading (direction)
+ Vector2 pos(start);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ Wait(application);
+
+ for(int i = 0;i<frames;i++)
+ {
+ pos += direction; // Move in this direction
+ SendPan(application, Gesture::Continuing, pos);
+ Wait(application);
+ }
+
+ if(finish)
+ {
+ pos += direction; // Move in this direction.
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, RENDER_DELAY_SCROLL);
+ }
+
+ return pos;
+}
+
+static void UtcDaliScrollViewScrollSensitive()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewScrollSensitive");
+
+ // 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 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<Vector3>( 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<Vector3>( 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<float>(overshootXProperty);
+ float overshootYValue = scrollView.GetProperty<float>(overshootYProperty);
+ Vector3 positionValue = scrollView.GetProperty<Vector3>(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);
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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::Vector3>( 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<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+
+ gPages.clear();
+ for(int row = 0;row<rows;row++)
+ {
+ for(int column = 0;column<columns;column++)
+ {
+ Actor page = Actor::New();
+ page.ApplyConstraint( Constraint::New<Vector3>( 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<Vector3>( 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<Vector3>( 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<Vector3>( 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<Vector3>( 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<Vector3>( 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<Vector3>( 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();
+}
--- /dev/null
+utc-Dali-RotatingSelector
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-RotatingSelector \
--- /dev/null
+/dali-test-suite/selectors/utc-Dali-RotatingSelector
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali-toolkit/public-api/controls/selectors/rotating-selector.h>
+
+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 );
+
+}
--- /dev/null
+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
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+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 \
--- /dev/null
+/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
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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() );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<Vector3>(), testVector3, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetAmbientLightColorPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetDiffuseLightColorPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetStatePropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetLightingMultiplierPropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetHeightScalePropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
+
+ Vector3 normalizedVector3(testVector3);
+ normalizedVector3.Normalize();
+ DALI_TEST_EQUALS( effect2.GetProperty( effect2.GetPropertyIndex( effect2.GetFixedNormalPropertyName() ) ).Get<Vector3>(), normalizedVector3, TEST_LOCATION );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/shader-effects/distance-field-effect.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
+
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
+
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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);
+ }
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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() );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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) ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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) ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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);
+ }
+ }
+}
--- /dev/null
+utc-Dali-Slider
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-Slider \
--- /dev/null
+/dali-test-suite/slider/utc-Dali-Slider
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/public-api/controls/slider/slider.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<float>(i) / ( NUM_MARKS - 1) ) * ( MAX_BOUND - MIN_BOUND ) );
+ }
+ slider.SetProperty( slider.GetPropertyIndex( Slider::MARKS_PROPERTY_NAME ), marks );
+ slider.SetProperty( slider.GetPropertyIndex( Slider::MARK_TOLERANCE_PROPERTY_NAME ), 0.1f );
+
+ slider.ValueChangedSignal().Connect( &OnSliderValueChanged );
+ slider.MarkSignal().Connect( &OnSliderMark );
+
+ application.SendNotification();
+ application.Render();
+
+ gSliderValueChangedCallBackCalled = false;
+ gSliderMarkCallBackCalled = false;
+
+ Dali::Integration::TouchEvent event;
+
+ event = Dali::Integration::TouchEvent();
+
+ const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f );
+ event.AddPoint( pointDown );
+
+ for( int i = 0; i < 5; ++i )
+ {
+ const Dali::TouchPoint pointDown( 0, TouchPoint::Motion, 10.0f + i * 10.0f, 10.0f );
+ event.AddPoint( pointDown );
+ }
+
+ const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 50.0f, 10.0f );
+ event.AddPoint( pointUp );
+
+ application.ProcessEvent( event );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSliderValueChangedCallBackCalled);
+ DALI_TEST_CHECK(gSliderMarkCallBackCalled);
+}
--- /dev/null
+utc-Dali-SuperBlurView
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-SuperBlurView \
--- /dev/null
+/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/controls/super-blur-view/super-blur-view.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 ) );
+
+}
--- /dev/null
+utc-Dali-TableView
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-TableView \
--- /dev/null
+/dali-test-suite/table-view/utc-Dali-TableView
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/controls/table-view/table-view.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<Vector3>( 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<Actor> actorsRemoved;
+ tableView.DeleteRow(0, actorsRemoved);
+ tet_printf("Row Delete >> Actors Removed: %d {", actorsRemoved.size());
+ for(size_t i = 0;i<actorsRemoved.size();i++) tet_printf("%d => %s, ", i, actorsRemoved[i].GetName().c_str());
+ tet_printf("}\n");
+ DALI_TEST_EQUALS( static_cast<int>(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<actorsRemoved.size();i++) tet_printf("%d => %s, ", i, actorsRemoved[i].GetName().c_str());
+ tet_printf("}\n");
+ DALI_TEST_EQUALS( static_cast<int>(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<int>(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);
+ }
+}
--- /dev/null
+#!/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"
--- /dev/null
+utc-Dali-TextInput
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-TextInput \
--- /dev/null
+/dali-test-suite/text-input/utc-Dali-TextInput
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali/integration-api/events/key-event-integ.h>
+
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 = "<i>Text with italic style</i>" ;
+ 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<float> boundingRectangle( 100.0f, 100.0f, stageSize.width, stageSize.height );
+
+ textInput.SetBoundingRectangle( boundingRectangle );
+
+ const Rect<float> 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 String<i>ab</i>" ;
+ 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 <i>String</i> 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 = "<i>Test String to style</i>";
+ 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 Stringa<i>b</i>" ;
+ 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::Type>( 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::Type>( 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 );
+}
--- /dev/null
+utc-Dali-TextView
+utc-Dali-MarkupProcessor
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-TextView \
+ utc-Dali-MarkupProcessor \
--- /dev/null
+/dali-test-suite/text-view/utc-Dali-TextView
+/dali-test-suite/text-view/utc-Dali-MarkupProcessor
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/markup-processor/markup-processor.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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><u >Styled< / u> Text< /i >< / font >< br / >" );
+ const std::string text4( "<font face='FreeSerif' size='14' color='0xaadd8744'><b><u>Styled</u> Te<font size='20'>x</font>t</b></font>< br/>" );
+ const std::string text5( "< shadow color = 'blue' paramx = '1' paramy = '0.75' >Shadow< / shadow><br />" );
+ const std::string text6( "<smooth param= '0.75' >< glow color = 'red' param = '0.1' >Glow</glow></smooth>< br />" );
+ const std::string text7( "<font color='green''>< outline color = 'red' paramx = '0.7' paramy = '0.7' >Outline< / outline >< /font >< br / >" );
+ const std::string text8( "<smooth param='0.75'>Smooth</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( "<font face='FreeSerif' color='green'>t</font>" );
+ const std::string result3( "<font face='FreeSerif' style='Bold' size='16' color='red'><i><u>Styled</u></i></font><font face='FreeSerif' style='Bold' size='16' color='red'><i> Text</i></font><br />" );
+ const std::string result4( "<font face='FreeSerif' size='14' color='0xaadd8744'><b><u>Styled</u></b></font><font face='FreeSerif' size='14' color='0xaadd8744'><b> Te</b></font><font face='FreeSerif' size='20' color='0xaadd8744'><b>x</b></font><font face='FreeSerif' size='14' color='0xaadd8744'><b>t</b></font><br />" );
+ const std::string result5( "<shadow color='blue' paramx='1' paramy='0.75'>Shadow</shadow><br />" );
+ const std::string result6( "<smooth param='0.75'><glow color='red' param='0.1'>Glow</glow></smooth><br />" );
+ const std::string result7( "<font color='green'><outline color='red' paramx='0.7' paramy='0.7'>Outline</outline></font><br />" );
+ const std::string result8( "<smooth param='0.75'>Smooth</smooth><br />" );
+ const std::string result9( text9 );
+ const std::string result10( text10 );
+ const std::string result11( "<br />" );
+
+ 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( "<font color='green'><i>Text with no defined style</i></font>" );
+ const std::string result2( "Text with <font color='green'><i>no defined</i></font> 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( "<font color='0xFF000000'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='0xFFFFFFFF'>white</font>" ),
+ std::string( "white" )
+ },
+ {
+ std::string( "<font color='0xFFFF0000'>red</font>" ),
+ std::string( "<font color='red'>red</font>" )
+ },
+ {
+ std::string( "<font color='0xFF00FF00'>green</font>" ),
+ std::string( "<font color='green'>green</font>" )
+ },
+ {
+ std::string( "<font color='0xFF0000FF'>blue</font>" ),
+ std::string( "<font color='blue'>blue</font>" )
+ },
+ {
+ std::string( "<font color='0xFFFFFF00'>yellow</font>" ),
+ std::string( "<font color='yellow'>yellow</font>" )
+ },
+ {
+ std::string( "<font color='0xFFFF00FF'>magenta</font>" ),
+ std::string( "<font color='magenta'>magenta</font>" )
+ },
+ {
+ std::string( "<font color='0xFF00FFFF'>cyan</font>" ),
+ std::string( "<font color='cyan'>cyan</font>" )
+ },
+ {
+ std::string( "<font color='0x00000000'>transparent</font>" ),
+ std::string( "<font color='transparent'>transparent</font>" )
+ },
+ {
+ std::string( "<font color='#000000'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='#FFFFFF'>white</font>" ),
+ std::string( "white" )
+ },
+ {
+ std::string( "<font color='#FF0000'>red</font>" ),
+ std::string( "<font color='red'>red</font>" )
+ },
+ {
+ std::string( "<font color='#00FF00'>green</font>" ),
+ std::string( "<font color='green'>green</font>" )
+ },
+ {
+ std::string( "<font color='#0000FF'>blue</font>" ),
+ std::string( "<font color='blue'>blue</font>" )
+ },
+ {
+ std::string( "<font color='#FFFF00'>yellow</font>" ),
+ std::string( "<font color='yellow'>yellow</font>" )
+ },
+ {
+ std::string( "<font color='#FF00FF'>magenta</font>" ),
+ std::string( "<font color='magenta'>magenta</font>" )
+ },
+ {
+ std::string( "<font color='#00FFFF'>cyan</font>" ),
+ std::string( "<font color='cyan'>cyan</font>" )
+ },
+ {
+ std::string( "<font color='#000'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='#FFF'>white</font>" ),
+ std::string( "white" )
+ },
+ {
+ std::string( "<font color='#F00'>red</font>" ),
+ std::string( "<font color='red'>red</font>" )
+ },
+ {
+ std::string( "<font color='#0F0'>green</font>" ),
+ std::string( "<font color='green'>green</font>" )
+ },
+ {
+ std::string( "<font color='#00F'>blue</font>" ),
+ std::string( "<font color='blue'>blue</font>" )
+ },
+ {
+ std::string( "<font color='#FF0'>yellow</font>" ),
+ std::string( "<font color='yellow'>yellow</font>" )
+ },
+ {
+ std::string( "<font color='#F0F'>magenta</font>" ),
+ std::string( "<font color='magenta'>magenta</font>" )
+ },
+ {
+ std::string( "<font color='#0FF'>cyan</font>" ),
+ std::string( "<font color='cyan'>cyan</font>" )
+ },
+ {
+ std::string( "<font color='0x000000'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='black'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='white'>white</font>" ),
+ std::string( "white" )
+ },
+ {
+ std::string( "<font color='red'>red</font>" ),
+ std::string( "<font color='red'>red</font>" )
+ },
+ {
+ std::string( "<font color='0xFF00FF00'>green</font>" ),
+ std::string( "<font color='green'>green</font>" )
+ },
+ {
+ std::string( "<font color='blue'>blue</font>" ),
+ std::string( "<font color='blue'>blue</font>" )
+ },
+ {
+ std::string( "<font color='yellow'>yellow</font>" ),
+ std::string( "<font color='yellow'>yellow</font>" )
+ },
+ {
+ std::string( "<font color='magenta'>magenta</font>" ),
+ std::string( "<font color='magenta'>magenta</font>" )
+ },
+ {
+ std::string( "<font color='cyan'>cyan</font>" ),
+ std::string( "<font color='cyan'>cyan</font>" )
+ },
+ {
+ std::string( "<font color='transparent'>transparent</font>" ),
+ std::string( "<font color='transparent'>transparent</font>" )
+ },
+ {
+ std::string( "<outline color='white'>outline</outline>" ),
+ std::string( "<outline color='white'>outline</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 );
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali-toolkit/public-api/controls/text-view/text-view.h>
+#include <dali-toolkit/public-api/controls/alignment/alignment.h>
+
+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( "Hel<font size='10'>lo wo</font>rld!\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::Type>( Alignment::HorizontalLeft | Alignment::VerticalTop ),
+ static_cast<Alignment::Type>( Alignment::HorizontalLeft | Alignment::VerticalCenter ),
+ static_cast<Alignment::Type>( Alignment::HorizontalLeft | Alignment::VerticalBottom ),
+ static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalTop ),
+ static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalCenter ),
+ static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalBottom ),
+ static_cast<Alignment::Type>( Alignment::HorizontalRight | Alignment::VerticalTop ),
+ static_cast<Alignment::Type>( Alignment::HorizontalRight | Alignment::VerticalCenter ),
+ static_cast<Alignment::Type>( 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::Type>( Alignment::HorizontalCenter | Alignment::VerticalTop ) );
+ textView.SetLineJustification( TextView::Center );
+ textView.SetSize( 136.56252f, 100.f );
+
+ textView.SetText( "Hel<font color='green'>lo wo</font>rld!" );
+
+ application.SendNotification();
+ application.Render();
+
+ std::vector<Size> 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<Vector3> 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::Type>( 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( "Hel<font color='green'>lo world!</font> This <font color='green'>is</font> a sna<font color='green'>psho</font>t 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( "<u><font size='10'>gg<font size='14'>gg<font size='18'>gg<font size='22'>gg</font>gg</font>gg</font>gg</font></u>" );
+ textView.SetSnapshotModeEnabled( false );
+
+ textView.SetSize( 150.f, 100.f );
+
+ Stage::GetCurrent().Add( textView );
+
+ application.SendNotification();
+ application.Render();
+
+ std::vector<float> 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 );
+ }
+}
--- /dev/null
+utc-Dali-Alignment
+utc-Dali-ToolBar
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-ToolBar \
--- /dev/null
+/dali-test-suite/toolbar/utc-Dali-ToolBar
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit-test-suite-utils.h>
+
+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<Alignment::Type>( 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);
+}
--- /dev/null
+utc-Dali-CubeTransitionEffect
+utc-Dali-CubeTransitionWaveEffect
+utc-Dali-CubeTransitionCrossEffect
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-CubeTransitionEffect \
--- /dev/null
+/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+
+#include <dali-toolkit/public-api/transition-effects/cube-transition-effect.h>
+#include <dali-toolkit/public-api/transition-effects/cube-transition-wave-effect.h>
+#include <dali-toolkit/public-api/transition-effects/cube-transition-cross-effect.h>
+#include <dali-toolkit/public-api/transition-effects/cube-transition-fold-effect.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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<int>(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<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<float>(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<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<float>(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 );
+}
--- /dev/null
+utc-Dali-UIBuilder
--- /dev/null
+TARGETS += \
+ utc-Dali-UIBuilder \
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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);
+ }
+}
+
--- /dev/null
+utc-Dali-View
--- /dev/null
+../master-makefile.mk
\ No newline at end of file
--- /dev/null
+TARGETS += \
+ utc-Dali-View \
--- /dev/null
+/dali-test-suite/view/utc-Dali-View
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <tet_api.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali-toolkit/public-api/controls/view/view.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+
+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 );
+}
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
+#define __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali-test-suite-utils.h>
+
+#include "toolkit-test-application.h"
+#include "toolkit-application.h"
+
+#endif // __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-accessibility-manager.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
+#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// PUBLIC INCLUDES
+#include <dali/public-api/adaptor-framework/common/accessibility-manager.h>
+
+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__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-adaptor.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/map-wrapper.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+namespace Dali
+{
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Stub for RenderSurface
+ */
+class RenderSurface
+{
+};
+
+typedef Dali::Rect<int> PositionSize;
+
+/**
+ * Stub for the Adaptor
+ */
+class Adaptor
+{
+public:
+
+ typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2;
+
+ typedef std::pair<std::string, Dali::BaseHandle> SingletonPair;
+ typedef std::map<std::string, Dali::BaseHandle> SingletonContainer;
+ typedef SingletonContainer::const_iterator SingletonConstIter;
+
+public:
+
+ Adaptor(ToolkitAdaptor& toolkitAdaptor);
+ ~Adaptor();
+
+public:
+
+ void Start();
+ void Pause();
+ void Resume();
+ void Stop();
+ bool AddIdle(boost::function<void(void)> 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<void(void)> 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
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
+#define __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <boost/function.hpp>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/events/touch-point.h>
+#include <dali/public-api/math/rect.h>
+
+#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<int> 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<void(void)> 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<void(void)> 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__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-application.h"
+
+#include <boost/any.hpp>
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+#include <dali/public-api/adaptor-framework/common/orientation.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
+#define __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+namespace Dali
+{
+
+class Application;
+
+/**
+ * This creates a stubbed Application so that Application calls work.
+ * Furthermore, it provides an interface to see if certain methods were invoked.
+ */
+class ToolkitApplication
+{
+public: // Construction & Destruction
+
+ ToolkitApplication();
+ ~ToolkitApplication();
+
+public: // Getters
+
+ Application& GetApplication();
+
+public: // Signal Emissions
+
+public: // TEST FUNCTIONS
+
+ // Enumeration of Application methods
+ enum TestFuncEnum
+ {
+ };
+
+ void Reset()
+ {
+ mFunctionsCalled.Reset();
+ }
+
+ bool WasCalled(TestFuncEnum func)
+ {
+ switch(func)
+ {
+ }
+ return false;
+ }
+
+ void ResetCallStatistics(TestFuncEnum func)
+ {
+ switch(func)
+ {
+ }
+ }
+
+private:
+
+ struct TestFunctions
+ {
+ TestFunctions()
+ {
+ }
+
+ void Reset()
+ {
+ }
+ };
+
+ TestFunctions mFunctionsCalled;
+
+ // The Application Stub
+ Application* mApplicationStub;
+ friend class Application;
+};
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-clipboard-event-notifier.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__
+#define __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// PUBLIC INCLUDES
+#include <dali/public-api/adaptor-framework/common/clipboard-event-notifier.h>
+
+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__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-orientation.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__
+#define __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/common/orientation.h>
+
+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__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-physical-keyboard.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__
+#define __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// PUBLIC INCLUDES
+#include <dali/public-api/adaptor-framework/common/physical-keyboard.h>
+
+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__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-style-monitor.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__
+#define __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/common/style-monitor.h>
+
+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__
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEST_APPLICATION_H__
+#define __DALI_TOOLKIT_TEST_APPLICATION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali-test-suite-utils.h>
+
+#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__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-timer.h"
+// INTERNAL INCLUDES
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_TIMER_H__
+#define __DALI_TOOLKIT_TOOLKIT_TIMER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// PUBLIC INCLUDES
+#include <dali/public-api/adaptor-framework/common/timer.h>
+
+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__
--- /dev/null
+#!/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 <<!EOF
+LD_LIBRARY_PATH=$TET_ROOT/lib/tet3:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH
+echo
+echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+echo
+gdb \$*
+!EOF
+
+chmod 755 $tmp_script
+tcc -v TET_EXEC_TOOL=$TET_ROOT/bin/tet_start -v TET_EXEC_FILE=$tmp_script -e -j - ./ $scenario
+
+unlink $tmp_script
--- /dev/null
+#!/bin/sh
+
+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 <<!EOF
+LD_LIBRARY_PATH=$TET_ROOT/lib/tet3:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH
+echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+gdb \$*
+!EOF
+
+
+chmod 755 $tmp_script
+tcc -v TET_XTERM=/usr/bin/rxvt-xpm -v TET_XTERM_DISPLAY=192.168.129.2:0 -v TET_EXEC_TOOL=$TET_ROOT/bin/tet_start -v TET_EXEC_FILE=$tmp_script -e -j - ./ $scenario
+
+rm $tmp_script
--- /dev/null
+#!/bin/bash
+
+TEMP=`getopt -o ds: --long desktop,scenario: \
+ -n 'build_out.sh' -- "$@"`
+
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+
+# Note the quotes around `$TEMP': they are essential!
+eval set -- "$TEMP"
+
+scenario=all
+env=./_export_env.sh
+
+while true ; do
+ case "$1" in
+ -d|--desktop) env=./_export_desktop.sh ; shift ;;
+ -s|--scenario) scenario="$2" ; shift 2 ;;
+ --) shift ; break ;;
+ *) echo "Internal error!" ; exit 1 ;;
+ esac
+done
+
+
+# Source correct environment
+. $env
+
+
+echo PATH=$PATH
+echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+echo TET_ROOT=$TET_ROOT
+echo TET_SUITE_ROOT=$TET_SUITE_ROOT
+echo ARCH=$ARCH
+
+RESULT_DIR=results-$ARCH
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./ $scenario
+./tbp.pl $JOURNAL_RESULT
+
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+#!/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 <<EOH;
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+"http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<title>TETware Test Run Report</title>
+</head>
+<body bgcolor="white">
+<p><table border="1" width="100%" cellpadding="3" cellspacing="0">
+<tr><td bgcolor="#ccccff" class="heading1"><center><h1>
+TETware Test Run Report</h1></center></td></tr></table></p>
+<p><table border="0" cellpadding="2" cellspacing="1">
+<tr>
+<td align="left" class="noborder">Date of test run:</td>
+<td align="left" class="noborder">$date</td>
+</tr>
+<tr>
+<td align="left" class="noborder">Start time:</td>
+<td align="left" class="noborder">$time</td>
+</tr>
+</table></p>
+<hr>
+EOH
+}
+
+sub summary
+{
+ my $heading = shift;
+ my $summary_ref = shift;
+
+ print <<EOS1;
+ <p><table border="1" cellpadding="3" cellspacing="0">
+ <tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b>$heading</b></font></td></tr>
+ </table></p>
+ <p><table border="0" cellpadding="5" cellspacing="4">
+ <tr>
+ <td align="center" bgcolor="#cccccc" class="neutral"><b>Result</b></td>
+ <td align="center" bgcolor="#cccccc" class="neutral"><b>Count</b></td>
+ </tr>
+EOS1
+
+ my ($success_string, @blah) = grep(/(Success|PASS)/, keys(%$summary_ref));
+ my $successes = $summary_ref->{$success_string};
+ print <<EOS2;
+ <tr>
+ <td align="left" bgcolor="#33cc33" class="success">$success_string</td>
+ <td align="right" bgcolor="#33cc33" class="success">$successes</td>
+ </tr>
+EOS2
+
+ foreach my $key (sort(grep(!/(Success|PASS|Total)/, keys(%$summary_ref))))
+ {
+ my $fails = $summary_ref->{$key};
+ print <<EOS3;
+ <tr>
+ <td align="left" bgcolor="#ff5555" class="failure">$key</td>
+ <td align="right" bgcolor="#ff5555" class="failure">$fails</td>
+ </tr>
+EOS3
+ }
+
+ my $total = $summary_ref->{"Total"};
+ print <<EOS4;
+ <tr>
+ <td align="left" bgcolor="#cccccc" class="neutral"><b>Total</b></td>
+ <td align="right" bgcolor="#cccccc" class="neutral"><b>$total</b></td>
+ </tr>
+ </table></p>
+EOS4
+}
+
+
+sub build_breakdown
+{
+ print <<EOB;
+<hr>
+<p><table border="1" cellpadding="3" cellspacing="0">
+<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b>
+Build mode result breakdown</b></font></td></tr></table></p>
+<p><table border="0" cellpadding="5" cellspacing="4">
+<tr>
+<td align="center" bgcolor="#cccccc" class="neutral"><b>Testcase</b></td>
+<td align="center" bgcolor="#cccccc" class="neutral"><b>Result</b></td>
+</tr>
+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("<tr><td align=\"left\" bgcolor=\"$color\" class=\"$class\">$key</td>\n");
+ print("<td align=\"left\" bgcolor=\"$color\" class=\"$class\">$Class</td>\n");
+ }
+ print("</table><p>");
+}
+
+
+sub execute_breakdown
+{
+ print <<EOE;
+<hr>
+<p><table border="1" cellpadding="3" cellspacing="0">
+<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b>
+Execute mode result breakdown</b></font></td></tr></table></p>
+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 "<h3>$result</h3>\n";
+ print <<EOE2;
+ <p><table border="0" cellpadding="5" cellspacing="4">
+ <tr>
+ <td align="center" bgcolor="#cccccc" class="neutral"><b>Testcase</b></td>
+ <td align="center" bgcolor="#cccccc" class="neutral"><b>Test purposes (IC.TP)</b></td>
+ </tr>
+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;
+ <tr>
+ <td align="left" bgcolor=$bgcolor class=$result>$testcase</td>
+ <td align="left" bgcolor=$bgcolor class=$result>$tests</td>
+ </tr>
+EOE3
+ }
+ print "</table>";
+ }
+}
+
+
+sub footer
+{
+ print "<hr>\n</body>\n</html>\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";
--- /dev/null
+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
--- /dev/null
+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?
--- /dev/null
+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
--- /dev/null
+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 ?
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
#!/bin/bash
-TEMP=`getopt -o 2vds: --long 2,verbose,desktop,scenario: \
- -n 'build_out.sh' -- "$@"`
+rm -rf build
+mkdir build
-if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+function build
+{
+ (cd src/$1; ../../scripts/tcheadgen.sh tct-$1-core.h)
+ if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+ (cd build ; cmake .. -DMODULE=$1 ; make -j7 )
+}
-# Note the quotes around `$TEMP': they are essential!
-eval set -- "$TEMP"
+if [ -n "$1" ] ; then
+ echo BUILDING ONLY $1
+ build $1
-scenario=all
-opt_verbose=0
-opt_env=scratchbox
-
-while true ; do
- case "$1" in
- -d|--desktop) opt_env=desktop ; shift ;;
- -s|--scenario) scenario="$2" ; shift 2 ;;
- -v|--verbose) opt_verbose=1 ; shift ;;
- -2|--2) opt_env=sbs ; shift ;;
- --) shift ; break ;;
- *) echo "Internal error!" ; exit 1 ;;
- esac
-done
-
-
-case "$opt_env" in
- desktop)
- . _export_desktop.sh
- cat <<EOF > coverage.mk
-LDFLAGS += --coverage
-EOF
- ;;
- scratchbox)
- . _export_env.sh
- cat <<EOF > coverage.mk
-LDFLAGS +=
-EOF
- ;;
- sbs)
- . _export_sbs.sh
- cat <<EOF > coverage.mk
-LDFLAGS +=
-EOF
- ;;
-esac
-
-
-echo PATH=$PATH
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-echo TET_ROOT=$TET_ROOT
-echo TET_SUITE_ROOT=$TET_SUITE_ROOT
-echo ARCH=$ARCH
-
-RESULT_DIR=results-$ARCH
-HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
-
-# Faster cleanup.
-find . -name Makefile -execdir make -f {} clean \;
-
-mkdir -p $RESULT_DIR
-if [ $opt_verbose -eq 1 ] ; then
- tcc -b -j - ./ $scenario | tee $JOURNAL_RESULT
else
- tcc -b -j $JOURNAL_RESULT -p ./ $scenario
+ for mod in `ls -1 src/ | grep -v CMakeList `
+ do
+ if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
+ echo BUILDING $mod
+ build $mod
+ fi
+ done
fi
-./tbp.pl $JOURNAL_RESULT
-
-
+++ /dev/null
-#!/bin/bash
-
-./build.sh -v $*
+++ /dev/null
-LDFLAGS += --coverage
( cd ../build/slp ; make cov_data )
-for i in `find . -name Makefile` ; do
+
+for i in `find . -name "*.dir"` ; do
(
- cd $(dirname $i)
+ cd $i
echo `pwd`
covs=( `ls *.gcda 2>/dev/null` )
if [[ $? -eq 0 ]]
then
- make coverage
+ lcov --directory . -c -o dali.info
+ lcov --remove dali.info "*boost*" "/usr/include/*" "*/automated-tests/*" -o dali.info
fi
)
done
cd .. ;
genhtml -o build/slp/doc/coverage `find . -name dali.info`
)
-
-
+++ /dev/null
-#
-# Copyright (c) 2014 Samsung Electronics Co., Ltd.
-#
-# Licensed under the Flora License, Version 1.0 (the License);
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://floralicense.org/license/
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an AS IS BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-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
+++ /dev/null
-../dali-test-suite/tc-gen.sh
\ No newline at end of file
+++ /dev/null
-utc-Dali-TextInput
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-TextInput \
+++ /dev/null
-/dali-internal-test-suite/text-input/utc-Dali-TextInput
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali/integration-api/events/key-event-integ.h>
-
-// Internal includes
-#include <dali-toolkit/internal/controls/text-input/text-input-impl.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( 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<Toolkit::Internal::TextInput&>( 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);
-}
+++ /dev/null
-utc-Dali-TextView
-utc-Dali-TextView-HelperAndDebug
-utc-Dali-TextView-Processor
-utc-Dali-TextView-Processor-Types
-utc-Dali-TextView-Relayout-Utilities
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-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
+++ /dev/null
-/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
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-// Internal headers are allowed here
-#include <dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-impl.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h>
-
-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 te<font size='30'>xt text te</font>xt text\n"
- "text t<font size='30'>ext טקסט טקסט te</font>xt\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( "t<font size='30'>ext text te</font>xt text text\n"
- "text text טקסט טקסט text\n"
- "text text te<font size='30'>xt text</font> text\n"
- "\n" ),
- 76,
- 4,
- 0,
- 0,
- 0
- },
- {
- std::string( "Test position 73. (the last \\n)" ),
- std::string( "text te<font size='30'>xt text text </font>text\n"
- "text text טק<font size='30'>סט טקס</font>ט 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 te<font size='30'>xt text text text\n</font>"
- "text text טק<font size='30'>סט טקסט </font>text\n"
- "text te<font size='30'>xt text text</font> 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 te<font size='30'>xt text text text\n</font>"
- "text text טק<font size='30'>סט טקסט </font>text\n"
- "text te<font size='30'>xt text text</font> text\n"
- "\n" ),
- 33,
- 1,
- 0,
- 2,
- 3
- },
- {
- std::string( "Test position 43. (last hebrew character)" ),
- std::string( "text te<font size='30'>xt text text text\n</font>"
- "text text טק<font size='30'>סט טקסט </font>text\n"
- "text te<font size='30'>xt text text</font> 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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-// Internal headers are allowed here
-#include <dali-toolkit/internal/controls/text-view/text-view-processor-types.h>
-
-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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-// Internal headers are allowed here
-#include <dali-toolkit/internal/controls/text-view/text-processor.h>
-
-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<MarkupProcessor::StyledTextArray> 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<MarkupProcessor::StyledTextArray> 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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-// Internal headers are allowed here
-#include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
-
-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 <font size='14'>world</font>", // 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 <font size='14'>wo</font>rld hell<font size='14'>o world</font>", // 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 <font size='14'>wo</font>rld hell<font size='14'>o world</font>", // 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.",
- "Hell<font size='14'>o</font> 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 <font size='14'>wo</font>rld <font size='16'>hello world</font>", // 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 <font size='14'>world</font>", // 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<font size='14'> world</font>", // 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 );
-
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-// Internal headers are allowed here
-#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-line-processor.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
-#include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
-
-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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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( "Hel<font size='10'>lo wo</font>rld!\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( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- 0,
- std::string( "" ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- },
- {
- std::string( "Split word, position 8." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- 8,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- std::string( "" ),
- },
- {
- std::string( "Split word, position 2." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- 2,
- std::string( "<font size='10'>He</font>" ),
- std::string( "<font size='12'>ll</font><font size='10'>oooo</font>" ),
- },
- {
- std::string( "Split word, position 3." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- 3,
- std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
- std::string( "<font size='12'>l</font><font size='10'>oooo</font>" ),
- },
- {
- std::string( "Split word, position 4." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- 4,
- std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
- std::string( "<font size='10'>oooo</font>" ),
- },
- };
- 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("<b>\nh</b>"),
- 0.f,
- std::string("Hello world<b>\nh</b>ello 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 <font size='30'>world\nhello</font> world"),
- 7,
- 3,
- std::string(), // Not used.
- 0.f,
- std::string( "Hello <font size='30'>wd\nhello</font> 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 <font size='30'>w<font size='20'>orl</font>d\nhello</font> world"),
- 7,
- 3,
- std::string(), // Not used.
- 0.f,
- std::string( "Hello <font size='30'>wd\nhello</font> 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 <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
- 7,
- 3,
- std::string(), // Not used.
- 0.f,
- std::string( "Hello <font size='30'>w</font><font size='10'>d\nhello</font> world" )
- },
- // * Remove whole word (merge words)
- {
- std::string( "Remove within the same word, whole word (merge words)" ),
- Remove,
- std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
- 5,
- 1,
- std::string(), // Not used.
- 0.f,
- std::string( "Hello<font size='30'>w</font>orl<font size='10'>d\nhello</font> 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 <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
- 6,
- 5,
- std::string(), // Not used.
- 0.f,
- std::string( "Hello <font size='10'>\nhello</font> world" )
- },
- // * Remove whole word (merge lines)
- {
- std::string( "Remove within the same word, whole word (merge lines)" ),
- Remove,
- std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
- 11,
- 1,
- std::string(), // Not used.
- 0.f,
- std::string( "Hello <font size='30'>w</font>orl<font size='10'>dhello</font> 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 <font color='green'>world</font>" ),
- 0,
- 7,
- std::string( "<font color='red'>Hello w</font>" ),
- 0.f,
- std::string( "<font color='red'>Hello w</font><font color='green'>orld</font>" )
- },
- {
- std::string( "Replace style from the middle of the text to the end." ),
- Replace,
- std::string( "Touch me\nhello" ),
- 6,
- 8,
- std::string( "<b>me\nhello</b>" ),
- 0.f,
- std::string( "Touch <b>me\nhello</b>" )
- },
- {
- 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( "<b>me\nhello</b>" ),
- 0.f,
- std::string( "Touch <b>me\nhello</b>\nworld" )
- },
- {
- std::string( "Replace style from the middle of the text 1." ),
- Replace,
- std::string( "Touch me\nhello\nworld" ),
- 6,
- 8,
- std::string( "<b>me\nhello</b>" ),
- 0.f,
- std::string( "Touch <b>me\nhello</b>\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( "<b>me\nhello\n</b>" ),
- 0.f,
- std::string( "Touch <b>me\nhello\n</b>world" )
- },
- };
- 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( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
- 0,
- 0,
- std::string( "" ),
- std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
- },
- {
- std::string( "Split word group, wordPosition 2, position 8." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 2,
- 7,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- std::string( "" ),
- },
- {
- std::string( "Split word group, wordPosition 0, position 2." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 0,
- 2,
- std::string( "<font size='10'>He</font>" ),
- std::string( "<font size='12'>ll</font><font size='10'>oooo wooorld</font>" ),
- },
- {
- std::string( "Split word group, wordPosition 0, position 3." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 0,
- 3,
- std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
- std::string( "<font size='12'>l</font><font size='10'>oooo wooorld</font>" ),
- },
- {
- std::string( "Split word group, wordPosition 0, position 4." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 0,
- 4,
- std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
- std::string( "<font size='10'>oooo wooorld</font>" ),
- },
- {
- std::string( "Split word group, wordPosition 1, position 0." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 1,
- 0,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- std::string( "<font size='10'> wooorld</font>" ),
- },
- };
- 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( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 0,
- 0,
- 0,
- 3.f,
- std::string( "" ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- },
- {
- std::string( "Split line, groupPosition 2, wordPosition 2, position 4." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 2,
- 2,
- 4,
- 0.f,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- std::string( "" ),
- },
- /* TODO check when RTL is working.
- {
- std::string( "Split line, groupPosition 1, wordPosition 2, position 0." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 1,
- 2,
- 0,
- 0.f,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום" ),
- std::string( " עולם text text" ),
- },
- {
- std::string( "Split line, groupPosition 1, wordPosition 0, position 0." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 1,
- 0,
- 0,
- 0.f,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> " ),
- std::string( "שלום עולם text text" ),
- },
- */
- {
- std::string( "Split line, groupPosition 2, wordPosition 0, position 0." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 2,
- 0,
- 0,
- 6.f,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם " ),
- 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( "<font size='10>Hel</font>" ),
- std::string( "<font size='20'>lo</font>" ),
- std::string( "<font size='10'>Hel</font><font size='20'>lo</font>" )
- },
- };
- 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( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
- 1,
- 2,
- std::string( "<font size='10'>H</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
- },
- {
- std::string( "Delete starting in one group of characters and finishing in a different one. No merge of groups." ),
- std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
- 2,
- 3,
- std::string( "<font size='10'>He</font><font size='20'>Wo</font><font size='30'>rld</font>" ),
- },
- {
- std::string( "Delete within the same group of characters. Starting just after a different one." ),
- std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
- 7,
- 2,
- std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>d</font>" ),
- },
- {
- std::string( "Delete whole group of characters. No merge" ),
- std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
- 3,
- 4,
- std::string( "<font size='10'>Hel</font><font size='30'>rld</font>" ),
- },
- {
- std::string( "Delete whole group of characters and part of the adjacent ones. No merge" ),
- std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
- 2,
- 6,
- std::string( "<font size='10'>He</font><font size='30'>ld</font>" ),
- },
- {
- std::string( "Delete whole group of characters. Merge" ),
- std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
- 3,
- 4,
- std::string( "<font size='10'>Helrld</font>" ),
- },
- {
- std::string( "Delete whole group of characters and part of the adjacent ones. Merge" ),
- std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
- 2,
- 6,
- std::string( "<font size='10'>Held</font>" ),
- },
- };
- 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( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
- 1,
- 4,
- std::string( "<font size='10'>Hel</font><font size='20'>lo</font><font size='30'> world</font>" ),
- },
- {
- std::string( "Delete words up to the end" ),
- std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
- 5,
- 2,
- std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello</font>" ),
- },
- {
- 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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-// 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);
- }
-}
-
+++ /dev/null
-utc-Dali-ScrollViewEffect
+++ /dev/null
-utc-Dali-Alignment
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-Alignment \
+++ /dev/null
-/dali-test-suite/alignment/utc-Dali-Alignment
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/key-event-integ.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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);
-}
+++ /dev/null
-utc-Dali-BubbleEmitter
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-BubbleEmitter \
+++ /dev/null
-/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-utc-Dali-Builder
-utc-Dali-JsonParser
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- Dali/utc-Dali-Builder \
- Dali/utc-Dali-JsonParser \
+++ /dev/null
-/dali-test-suite/builder/utc-Dali-Builder
-/dali-test-suite/builder/utc-Dali-JsonParser
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/builder/builder.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-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<float>() );
-
- v = camera.GetProperty( camera.GetPropertyIndex("aspect-ratio") );
- DALI_TEST_CHECK( 5.0f == v.Get<float>() );
-
- handle = builder.CreateFromStyle("basic-text");
- TextActor textActor = TextActor::DownCast(handle);
-
- v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") );
-
- DALI_TEST_CHECK( 0.2f == v.Get<float>() );
-
- // test ApplyStyle another
- builder.ApplyStyle("theme2-text", textActor);
-
- v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") );
- DALI_TEST_CHECK( 0.8f == v.Get<float>() );
-
-}
-
-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" );
-
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/builder/json-parser.h>
-
-#include <dali-toolkit-test-suite-utils.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];
-}
-
-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<int>(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);
-}
+++ /dev/null
-utc-Dali-CheckBoxButton
-utc-Dali-PushButton
-utc-Dali-Button
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-CheckBoxButton \
- utc-Dali-PushButton \
- utc-Dali-Button \
+++ /dev/null
-/dali-test-suite/buttons/utc-Dali-CheckBoxButton
-/dali-test-suite/buttons/utc-Dali-PushButton
-/dali-test-suite/buttons/utc-Dali-Button
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
-#include <dali-toolkit/public-api/controls/buttons/push-button.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<CheckBoxButton&>( 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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-toolkit/public-api/controls/buttons/push-button.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali-toolkit/internal/controls/buttons/button-impl.h>
-
-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<PushButton&>( 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<TETButton, Internal::TETButton>(handle);
-}
-
-TETButton::PressedSignalV2& TETButton::PressedSignal()
-{
- TETButton button( *this );
- DALI_ASSERT_ALWAYS( button );
-
- Dali::RefObject& handle = button.GetImplementation();
-
- return static_cast<Toolkit::Internal::TETButton&>( handle ).PressedSignal();
-}
-
-TETButton::TETButton( Internal::TETButton& implementation )
-: Button( implementation )
-{}
-
-TETButton::TETButton( Dali::Internal::CustomActor* internal )
-: Button( internal )
-{
- VerifyCustomActorPointer<Internal::TETButton>(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 );
- }
-}
+++ /dev/null
-utc-Dali-Cluster
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-Cluster \
+++ /dev/null
-/dali-test-suite/cluster/utc-Dali-Cluster
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-utc-Dali-ControlImpl
-utc-Dali-Control
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
-#define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/dali-toolkit.h>
-
-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<DummyControl, DummyControlImpl>(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),
- styleChangeCalled(false),
- pinchCalled(false),
- panCalled(false),
- tapCalled(false),
- longPressCalled(false),
- stageConnectionCalled(false),
- stageDisconnectionCalled(false),
- childAddCalled(false),
- childRemoveCalled(false),
- sizeSetCalled(false),
- sizeAnimationCalled(false),
- touchEventCalled(false),
- mouseWheelEventCalled(false),
- keyEventCalled(false),
- keyInputFocusGained(false),
- keyInputFocusLost(false)
- {
- }
-
- virtual ~DummyControlImplOverride() { }
-
-private: // From ControlImpl
-
- virtual void OnInitialize() { initializeCalled = true; }
- virtual void OnStyleChange(StyleChange change) { styleChangeCalled = 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 styleChangeCalled;
- bool pinchCalled;
- bool panCalled;
- bool tapCalled;
- bool longPressCalled;
- bool stageConnectionCalled;
- bool stageDisconnectionCalled;
- bool childAddCalled;
- bool childRemoveCalled;
- bool sizeSetCalled;
- bool sizeAnimationCalled;
- bool touchEventCalled;
- bool mouseWheelEventCalled;
- bool keyEventCalled;
- bool keyInputFocusGained;
- bool keyInputFocusLost;
-};
-
-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<DummyControlImpl>(internal);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
+++ /dev/null
-TARGETS += \
- utc-Dali-ControlImpl \
- utc-Dali-Control \
+++ /dev/null
-/dali-test-suite/control/utc-Dali-ControlImpl
-/dali-test-suite/control/utc-Dali-Control
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-#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;
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali/integration-api/events/key-event-integ.h>
-#include <dali/integration-api/events/mouse-wheel-event-integ.h>
-#include <dali/integration-api/events/long-press-gesture-event.h>
-#include <dali/integration-api/events/pinch-gesture-event.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-#include <dali/integration-api/events/tap-gesture-event.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-#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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImplOverride&>(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<DummyControlImpl&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(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<DummyControlImplOverride&>(dummy.GetImplementation());
-
- dummyImpl.OnAccessibilityValueChange( true );
- dummyImpl.IsKeyboardNavigationSupported();
- dummyImpl.IsKeyboardFocusGroup();
-
- Stage::GetCurrent().Remove(dummy);
- }
-}
+++ /dev/null
-utc-Dali-DefaultControls
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-DefaultControls \
+++ /dev/null
-/dali-test-suite/default-controls/utc-Dali-DefaultControls
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/controls/tool-bar/tool-bar.h>
-#include <dali-toolkit/public-api/controls/view/view.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-#include <dali-toolkit/public-api/controls/default-controls/push-button-factory.h>
-#include <dali-toolkit/public-api/controls/default-controls/check-button-factory.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-utc-Dali-FocusManager
-utc-Dali-KeyInputFocusManager
-utc-Dali-KeyboardFocusManager
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-FocusManager \
- utc-Dali-KeyInputFocusManager \
- utc-Dali-KeyboardFocusManager
+++ /dev/null
-/dali-test-suite/focus-manager/utc-Dali-FocusManager
-/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager
-/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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);
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali/integration-api/events/key-event-integ.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali/integration-api/events/key-event-integ.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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();
-}
+++ /dev/null
-utc-Dali-ItemView
-utc-Dali-ItemLayout
-utc-Dali-GridLayout
-utc-Dali-DepthLayout
-utc-Dali-SpiralLayout
-utc-Dali-NavigationLayout
-utc-Dali-AlbumLayout
-utc-Dali-RollLayout
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-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 \
+++ /dev/null
-/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
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<Vector3> 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<float> 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<float> 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<Vector2> 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));
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-#include <float.h> // for FLT_MAX
-#include <stdlib.h>
-#include <tet_api.h>
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-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<float>(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<unsigned int> 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);
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <float.h> // for FLT_MAX
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-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<float>(numberOfColumns - 1)) / static_cast<float>(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);
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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);
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <float.h> // for FLT_MAX
-#include <tet_api.h>
-
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<unsigned int> 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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <float.h> // for FLT_MAX
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-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<unsigned int> 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);
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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);
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <float.h> // for FLT_MAX
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-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<unsigned int> 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);
-}
+++ /dev/null
-#
-# Copyright (c) 2014 Samsung Electronics Co., Ltd.
-#
-# Licensed under the Flora License, Version 1.0 (the License);
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://floralicense.org/license/
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an AS IS BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-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
+++ /dev/null
-utc-Dali-NavigationControl
-utc-Dali-Page
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-NavigationControl \
- utc-Dali-Page \
+++ /dev/null
-/dali-test-suite/navigation-frame/utc-Dali-NavigationControl
-/dali-test-suite/navigation-frame/utc-Dali-Page
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-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() );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
-#include <dali-toolkit/public-api/controls/buttons/push-button.h>
-#include <dali-toolkit/public-api/controls/popup/popup.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-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() );
-}
+++ /dev/null
-utc-Dali-PageTurnView
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-PageTurnView \
+++ /dev/null
-/dali-test-suite/page-turn-view/utc-Dali-PageTurnView
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <string.h>
-#include <sstream>
-
-#include <dali/public-api/dali-core.h>
-
-#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
-#include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
-#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
-#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<float>( IMAGE_WIDTH ), static_cast<float>(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<frames;i++)
- {
- pos += direction; // Move in this direction
- SendPan(application, Gesture::Continuing, pos);
- Wait(application);
- }
-
- if(toFinish)
- {
- pos += direction; // Move in this direction
- SendPan(application, Gesture::Finished, pos);
- Wait(application);
- }
-
- return pos;
-}
-
-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;
-}
-
-//Functor to test whether PageTurnSignal / PagePanSignal is emitted
-class PageSignalCallback : public Dali::ConnectionTracker
-{
-public:
-
- PageSignalCallback( bool& signalReceived, PageTurnView& view, unsigned int& pageIndex, bool& isForwards )
- : mSignalVerified( signalReceived ),
- mView( view ),
- mPageIndex( pageIndex ),
- mIsTurningForwards( isForwards )
- {
- }
-
- // callback to be connected to PageTurnSignal
- void PageTurnSignalCallback( PageTurnView view, unsigned int pageIndex, bool isTurningForward )
- {
- tet_infoline( "Verifying PageTurnedSignal" );
-
- if( mView == view && mPageIndex == pageIndex && mIsTurningForwards == isTurningForward )
- {
- mSignalVerified = true;
- }
- }
-
- // callback to be connected to PagePanSignal
- void PagePanSignalCallback( PageTurnView view )
- {
- tet_infoline( "Verifying PagePannedSignal" );
-
- if( mView == view )
- {
- mSignalVerified = true;
- }
- }
-
- void Reset()
- {
- mSignalVerified = false;
- }
-
- bool& mSignalVerified;
- PageTurnView& mView;
- unsigned int& mPageIndex;
- bool& mIsTurningForwards;
-
-};
-
-}// 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( UtcDaliPageTurnPortraitViewNew, POSITIVE_TC_IDX );
-TEST_FUNCTION( UtcDaliPageTurnLandscapeViewNew, POSITIVE_TC_IDX );
-TEST_FUNCTION( UtcDaliPageTurnViewSetAndGetSpineShadowParameter, POSITIVE_TC_IDX );
-TEST_FUNCTION( UtcDaliPageTurnViewGoToPageAndGetCurrentPage, POSITIVE_TC_IDX );
-TEST_FUNCTION( UtcDaliPageTurnViewEnterLeaveEditMode, POSITIVE_TC_IDX );
-TEST_FUNCTION( UtcDaliPageTurnViewGetHitActor, POSITIVE_TC_IDX );
-TEST_FUNCTION( UtcDaliPageTurnViewRefresh, POSITIVE_TC_IDX );
-TEST_FUNCTION( UtcDaliPageTurnViewSignals, 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()
-{
-}
-
-//Implementation of PageFactory for providing page actors to PageTurnView
-class TestPageFactory : public PageFactory
-{
-public:
-
- TestPageFactory(ToolkitTestApplication& application)
- : mApplication( application )
- {
- mSourceActors.resize(TOTAL_PAGE_NUMBER);
- mTotalPageNumber = TOTAL_PAGE_NUMBER;
- }
-
- /**
- * Query the number of pages available from the factory.
- * The maximum available page has an ID of GetNumberOfPages()-1.
- */
- virtual unsigned int GetNumberOfPages()
- {
- return mTotalPageNumber;
- }
-
- /**
- * Create an image actor to represent a page.
- * @param[in] pageId The ID of the page to create.
- * @return An image actor, or an uninitialized pointer if the ID is out of range.
- */
- virtual Actor NewPage( unsigned int pageId )
- {
- if(!mSourceActors[pageId])
- {
- Actor actor = CreateSolidColorImageActor(mApplication, Color::BLUE,IMAGE_WIDTH,IMAGE_HEIGHT);
- actor.SetName( static_cast<std::ostringstream*>( &(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<Actor> 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);
-}
+++ /dev/null
-utc-Dali-Popup
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-Popup \
+++ /dev/null
-/dali-test-suite/popup/utc-Dali-Popup
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<numChildren; ++i)
- {
- count += DescendentCount(root.GetChildAt(i));
- }
-
- return count;
-}
-
-bool HasAncestor(Actor child, Actor ancestor)
-{
- while(child && child != ancestor)
- {
- child = child.GetParent();
- }
-
- return (child == ancestor);
-}
-
-}
-
-
-// Called only once before first test is run.
-static void Startup()
-{
-}
-
-// Called only once after last test is run
-static void Cleanup()
-{
-}
-
-static void UtcDaliPopupNew()
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliPopupNew");
-
- // Create the Popup actor
- Popup popup;
-
- DALI_TEST_CHECK( !popup );
-
- popup = Popup::New();
-
- DALI_TEST_CHECK( popup );
-
- Popup popup2(popup);
-
- DALI_TEST_CHECK( popup2 == popup );
-
- //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 );
- {
- Popup popup = Popup::New();
- }
- DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
-}
-
-static void UtcDaliPopupDestructor()
-{
- ToolkitTestApplication application;
-
- Popup* popup = new Popup();
- delete popup;
-
- DALI_TEST_CHECK( true );
-}
-
-static void UtcDaliPopupDownCast()
-{
- ToolkitTestApplication application;
-
- Handle handle = Popup::New();
-
- Popup popup = Popup::DownCast( handle );
-
- DALI_TEST_CHECK( popup == handle );
-}
-
-static void UtcDaliPopoupSetProperty()
-{
- tet_infoline("UtcDaliPopoupSetProperty: ");
- ToolkitTestApplication application;
-
- Popup popup = Popup::New();
-
- //Test properties
- std::string testString = "Hello World";
- popup.SetProperty(popup.GetPropertyIndex("title"), testString);
- DALI_TEST_EQUALS( testString, popup.GetTitle().GetText(), TEST_LOCATION );
-}
-
-
-static void UtcDaliPopupSetBackgroundImage()
-{
- ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- tet_infoline(" UtcDaliPopupSetBackgroundImage");
-
- // Create the Popup actor
- Popup popup = Popup::New();
- Stage::GetCurrent().Add( popup );
-
- ImageActor image = CreateSolidColorActor( Color::RED );
- DALI_TEST_CHECK( !image.GetParent() );
- popup.SetBackgroundImage(image);
- DALI_TEST_CHECK( image.GetParent() );
-}
-
-static void UtcDaliPopupSetTitle()
-{
- ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- tet_infoline(" UtcDaliPopupSetTitle");
-
- // Create the Popup actor
- Popup popup = Popup::New();
- Stage::GetCurrent().Add( popup );
- // Put in show state so it's layer is connected to popup (for ancestor check).
- popup.SetState(Popup::POPUP_SHOW, 0.0f);
-
- TextView titleActor = TextView::New();
- titleActor.SetText("title");
-
- DALI_TEST_CHECK( !popup.GetTitle() );
- popup.SetTitle(titleActor);
- DALI_TEST_CHECK( popup.GetTitle() == titleActor );
- DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "title") );
- // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
- DALI_TEST_CHECK( HasAncestor(titleActor, popup) );
-
- TextView titleActor2 = TextView::New();
- titleActor2.SetText("anothertitle");
- popup.SetTitle(titleActor2);
- DALI_TEST_CHECK( popup.GetTitle() != titleActor );
- DALI_TEST_CHECK( popup.GetTitle() == titleActor2 );
- DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "anothertitle") );
- // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
- DALI_TEST_CHECK( HasAncestor(titleActor2, popup) );
-}
-
-static void UtcDaliPopupSetTitleText()
-{
- ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- tet_infoline(" UtcDaliPopupSetTitleText");
-
- // Create the Popup actor
- Popup popup = Popup::New();
- Stage::GetCurrent().Add( popup );
- // Put in show state so it's layer is connected to popup (for ancestor check).
- popup.SetState(Popup::POPUP_SHOW, 0.0f);
-
- TextView titleActor = TextView::New();
- titleActor.SetText("title");
-
- DALI_TEST_CHECK( !popup.GetTitle() );
- popup.SetTitle(titleActor);
- DALI_TEST_CHECK( popup.GetTitle() == titleActor );
- DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "title") );
- // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
- DALI_TEST_CHECK( HasAncestor(titleActor, popup) );
-
- // this text should replace titleImage actor.
- popup.SetTitle("newtext");
- DALI_TEST_CHECK( popup.GetTitle() != titleActor );
- DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "newtext") );
- // verify titleActor is no longer inside popup. (been displaced by newtext actor)
- DALI_TEST_CHECK( !HasAncestor(titleActor, popup) );
-}
-
-static void UtcDaliPopupAddButton()
-{
- ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- tet_infoline(" UtcDaliPopupAddButton");
-
- // Create the Popup actor
- Popup popup = Popup::New();
- Stage::GetCurrent().Add( popup );
- // Put in show state so it's layer is connected to popup (for ancestor check).
- popup.SetState(Popup::POPUP_SHOW, 0.0f);
-
- PushButton button = PushButton::New();
- DALI_TEST_CHECK( !HasAncestor(button, popup) );
- popup.AddButton(button);
- // Hide and then re-show popup to cause button to be rearranged and added to popup.
- popup.SetState( Popup::POPUP_HIDE, 0.0f );
- popup.SetState( Popup::POPUP_SHOW, 0.0f );
- DALI_TEST_CHECK( HasAncestor(button, popup) );
-}
-
-static void UtcDaliPopupSetState()
-{
- ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- tet_infoline(" UtcDaliPopupSetState");
-
- // Create the Popup actor
- Popup popup = Popup::New();
- Stage::GetCurrent().Add( popup );
-
- ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
- popup.SetBackgroundImage(backgroundImage);
-
- // Showing/Hiding popup, results in all child Actors being
- // connected/disconnected from the stage.
- DALI_TEST_CHECK( !backgroundImage.OnStage() );
- popup.SetState(Popup::POPUP_SHOW, 0.0f);
- DALI_TEST_CHECK( backgroundImage.OnStage() );
- DALI_TEST_EQUALS( Popup::POPUP_SHOW, popup.GetState(), TEST_LOCATION );
- popup.SetState(Popup::POPUP_HIDE, 0.0f);
- DALI_TEST_CHECK( !backgroundImage.OnStage() );
- DALI_TEST_EQUALS( Popup::POPUP_HIDE, popup.GetState(), TEST_LOCATION );
-}
-
-static void UtcDaliPopupSetStateSlow()
-{
- ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- tet_infoline(" UtcDaliPopupSetStateSlow");
-
- // Create the Popup actor
- Popup popup = Popup::New();
- Stage::GetCurrent().Add( popup );
-
- ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
- popup.SetBackgroundImage(backgroundImage);
-
- // Showing/Hiding popup, results in all child Actors being
- // connected/disconnected from the stage.
- DALI_TEST_CHECK( !backgroundImage.OnStage() );
- popup.SetState(Popup::POPUP_SHOW, 0.0f);
- DALI_TEST_CHECK( backgroundImage.OnStage() );
-
- // Hide slowly
- popup.SetState(Popup::POPUP_HIDE);
-
- // Wait for a while (allow animation to complete), and then check state.
- for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
- {
- application.SendNotification();
- application.Render(RENDER_FRAME_INTERVAL);
- }
-
- DALI_TEST_CHECK( !backgroundImage.OnStage() );
-}
-
-static bool gHidden = false;
-
-static void OnPopupHidden()
-{
- gHidden = true;
-}
-
-static void UtcDaliPopupShowHide()
-{
- ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- tet_infoline(" UtcDaliPopupShowHide");
-
- // Create the Popup actor
- Popup popup = Popup::New();
- Stage::GetCurrent().Add( popup );
- popup.HiddenSignal().Connect( &OnPopupHidden );
-
- ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
- popup.SetBackgroundImage(backgroundImage);
-
- PushButton button1 = PushButton::New();
- PushButton button2 = PushButton::New();
- button1.SetSize(DEFAULT_BUTTON_SIZE);
- popup.AddButton(button1);
- button2.SetSize(DEFAULT_BUTTON_SIZE);
- popup.AddButton(button2);
-
- // Showing/Hiding popup, results in all child Actors being
- // connected/disconnected from the stage.
- DALI_TEST_CHECK( !backgroundImage.OnStage() );
-
- // Show
- // Note: in most popup animation implementations show would result in
- // popup being onstage immediately following Show(). However we can't
- // assume for all. e.g. If one creates a animation with a delay.
- popup.Show();
-
- // Wait for a while (allow animation to complete), and then check state.
- for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
- {
- application.SendNotification();
- application.Render(RENDER_FRAME_INTERVAL);
- }
-
- DALI_TEST_CHECK( backgroundImage.OnStage() );
-
- // Hide
- gHidden = false;
- popup.Hide();
-
- // Wait for a while (allow animation to complete), and then check state.
- for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
- {
- application.SendNotification();
- application.Render(RENDER_FRAME_INTERVAL);
- }
-
- DALI_TEST_CHECK( !backgroundImage.OnStage() );
- DALI_TEST_CHECK( gHidden );
-}
-
-static void UtcDaliPopupShowHideTail()
-{
- ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
- tet_infoline(" UtcDaliPopupShowHideTail");
-
- // Create the Popup actor
- Popup popup = Popup::New();
- Stage::GetCurrent().Add( popup );
- popup.SetState(Popup::POPUP_SHOW, 0.0f);
-
- popup.HideTail();
- int withoutTailCount = DescendentCount(popup);
-
- popup.ShowTail(ParentOrigin::BOTTOM_CENTER);
- int withTailCount = DescendentCount(popup);
-
- // There should be more actors if the Tail has been added.
- DALI_TEST_CHECK( withTailCount > 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);
-}
+++ /dev/null
-utc-Dali-ScrollView
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-ScrollView \
- utc-Dali-ScrollViewEffect \
+++ /dev/null
-/dali-test-suite/scroll-view/utc-Dali-ScrollView
-/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<MAX_FRAMES_TO_TEST_OVERSHOOT;i++)
- {
- float overshootXValue = scrollView.GetProperty<float>(overshootPropertyX);
- float overshootYValue = scrollView.GetProperty<float>(overshootPropertyY);
- if(overshootXValue == 0.0f && overshootYValue == 0.0f)
- {
- break;
- }
-
- timeToReachOrigin += Wait(application);
- }
-
- return static_cast<float>(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<int>(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<int>(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<int>(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<int>(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<int>(scrollView.GetCurrentPage()), 17, TEST_LOCATION );
- scrollView.SetWrapMode(true);
- DALI_TEST_EQUALS( static_cast<int>(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;i<CLAMP_GESTURE_FRAMES;i++)
- {
- SendPan(application, Gesture::Continuing, pos);
- pos += CLAMP_TOUCH_MOVEMENT; // Move South-West a little
- Wait(application);
-
- if((gLastClampPosition.x == Toolkit::NotClamped) && (gLastClampPosition.y == Toolkit::NotClamped) && (step==CLAMP_STEP_0_CHECK_NOTCLAMPED))
- {
- step = CLAMP_STEP_1_CHECK_CLAMPED_WEST;
- }
- else if((gLastClampPosition.x == Toolkit::ClampedToMin) && (gLastClampPosition.y == Toolkit::NotClamped) && (step==CLAMP_STEP_1_CHECK_CLAMPED_WEST))
- {
- step = CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST;
- }
- else if((gLastClampPosition.x == Toolkit::ClampedToMin) && (gLastClampPosition.y == Toolkit::ClampedToMax) && (step==CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST))
- {
- step = CLAMP_STEP_3_SUCCESS;
- }
- }
-
- SendPan(application, Gesture::Finished, pos);
- Wait(application);
-
- DALI_TEST_CHECK( gOnScrollClampedCalled );
- DALI_TEST_EQUALS( step, CLAMP_STEP_3_SUCCESS, TEST_LOCATION );
-}
-
-static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true)
-{
- gOnScrollStartCalled = false;
- gOnScrollUpdateCalled = false;
- gOnScrollCompleteCalled = false;
- gOnSnapStartCalled = false;
-
- // Now do a pan starting from (start) and heading (direction)
- Vector2 pos(start);
- SendPan(application, Gesture::Possible, pos);
- SendPan(application, Gesture::Started, pos);
- Wait(application);
-
- for(int i = 0;i<frames;i++)
- {
- pos += direction; // Move in this direction
- SendPan(application, Gesture::Continuing, pos);
- Wait(application);
- }
-
- if(finish)
- {
- pos += direction; // Move in this direction.
- SendPan(application, Gesture::Finished, pos);
- Wait(application, RENDER_DELAY_SCROLL);
- }
-
- return pos;
-}
-
-static void UtcDaliScrollViewScrollSensitive()
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewScrollSensitive");
-
- // 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 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<Vector3>( 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<Vector3>( 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<float>(overshootXProperty);
- float overshootYValue = scrollView.GetProperty<float>(overshootYProperty);
- Vector3 positionValue = scrollView.GetProperty<Vector3>(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);
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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::Vector3>( 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<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
-
- gPages.clear();
- for(int row = 0;row<rows;row++)
- {
- for(int column = 0;column<columns;column++)
- {
- Actor page = Actor::New();
- page.ApplyConstraint( Constraint::New<Vector3>( 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<Vector3>( 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<Vector3>( 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<Vector3>( 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<Vector3>( 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<Vector3>( 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<Vector3>( 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();
-}
+++ /dev/null
-utc-Dali-RotatingSelector
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-RotatingSelector \
+++ /dev/null
-/dali-test-suite/selectors/utc-Dali-RotatingSelector
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali-toolkit/public-api/controls/selectors/rotating-selector.h>
-
-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 );
-
-}
+++ /dev/null
-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
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-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 \
+++ /dev/null
-/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
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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() );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<Vector3>(), testVector3, TEST_LOCATION );
- DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetAmbientLightColorPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
- DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetDiffuseLightColorPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
- DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetStatePropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
- DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetLightingMultiplierPropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
- DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetHeightScalePropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
-
- Vector3 normalizedVector3(testVector3);
- normalizedVector3.Normalize();
- DALI_TEST_EQUALS( effect2.GetProperty( effect2.GetPropertyIndex( effect2.GetFixedNormalPropertyName() ) ).Get<Vector3>(), normalizedVector3, TEST_LOCATION );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/shader-effects/distance-field-effect.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
-
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
-
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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);
- }
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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() );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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) ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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) ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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);
- }
- }
-}
+++ /dev/null
-utc-Dali-Slider
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-Slider \
+++ /dev/null
-/dali-test-suite/slider/utc-Dali-Slider
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-toolkit/public-api/controls/slider/slider.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<float>(i) / ( NUM_MARKS - 1) ) * ( MAX_BOUND - MIN_BOUND ) );
- }
- slider.SetProperty( slider.GetPropertyIndex( Slider::MARKS_PROPERTY_NAME ), marks );
- slider.SetProperty( slider.GetPropertyIndex( Slider::MARK_TOLERANCE_PROPERTY_NAME ), 0.1f );
-
- slider.ValueChangedSignal().Connect( &OnSliderValueChanged );
- slider.MarkSignal().Connect( &OnSliderMark );
-
- application.SendNotification();
- application.Render();
-
- gSliderValueChangedCallBackCalled = false;
- gSliderMarkCallBackCalled = false;
-
- Dali::Integration::TouchEvent event;
-
- event = Dali::Integration::TouchEvent();
-
- const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f );
- event.AddPoint( pointDown );
-
- for( int i = 0; i < 5; ++i )
- {
- const Dali::TouchPoint pointDown( 0, TouchPoint::Motion, 10.0f + i * 10.0f, 10.0f );
- event.AddPoint( pointDown );
- }
-
- const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 50.0f, 10.0f );
- event.AddPoint( pointUp );
-
- application.ProcessEvent( event );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_CHECK(gSliderValueChangedCallBackCalled);
- DALI_TEST_CHECK(gSliderMarkCallBackCalled);
-}
+++ /dev/null
-utc-Dali-SuperBlurView
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-SuperBlurView \
+++ /dev/null
-/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/controls/super-blur-view/super-blur-view.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 ) );
-
-}
+++ /dev/null
-utc-Dali-TableView
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-TableView \
+++ /dev/null
-/dali-test-suite/table-view/utc-Dali-TableView
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/controls/table-view/table-view.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<Vector3>( 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<Actor> actorsRemoved;
- tableView.DeleteRow(0, actorsRemoved);
- tet_printf("Row Delete >> Actors Removed: %d {", actorsRemoved.size());
- for(size_t i = 0;i<actorsRemoved.size();i++) tet_printf("%d => %s, ", i, actorsRemoved[i].GetName().c_str());
- tet_printf("}\n");
- DALI_TEST_EQUALS( static_cast<int>(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<actorsRemoved.size();i++) tet_printf("%d => %s, ", i, actorsRemoved[i].GetName().c_str());
- tet_printf("}\n");
- DALI_TEST_EQUALS( static_cast<int>(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<int>(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);
- }
-}
+++ /dev/null
-#!/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"
+++ /dev/null
-utc-Dali-TextInput
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-TextInput \
+++ /dev/null
-/dali-test-suite/text-input/utc-Dali-TextInput
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali/integration-api/events/key-event-integ.h>
-
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 = "<i>Text with italic style</i>" ;
- 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<float> boundingRectangle( 100.0f, 100.0f, stageSize.width, stageSize.height );
-
- textInput.SetBoundingRectangle( boundingRectangle );
-
- const Rect<float> 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 String<i>ab</i>" ;
- 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 <i>String</i> 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 = "<i>Test String to style</i>";
- 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 Stringa<i>b</i>" ;
- 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::Type>( 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::Type>( 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 );
-}
+++ /dev/null
-utc-Dali-TextView
-utc-Dali-MarkupProcessor
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-TextView \
- utc-Dali-MarkupProcessor \
+++ /dev/null
-/dali-test-suite/text-view/utc-Dali-TextView
-/dali-test-suite/text-view/utc-Dali-MarkupProcessor
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/markup-processor/markup-processor.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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><u >Styled< / u> Text< /i >< / font >< br / >" );
- const std::string text4( "<font face='FreeSerif' size='14' color='0xaadd8744'><b><u>Styled</u> Te<font size='20'>x</font>t</b></font>< br/>" );
- const std::string text5( "< shadow color = 'blue' paramx = '1' paramy = '0.75' >Shadow< / shadow><br />" );
- const std::string text6( "<smooth param= '0.75' >< glow color = 'red' param = '0.1' >Glow</glow></smooth>< br />" );
- const std::string text7( "<font color='green''>< outline color = 'red' paramx = '0.7' paramy = '0.7' >Outline< / outline >< /font >< br / >" );
- const std::string text8( "<smooth param='0.75'>Smooth</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( "<font face='FreeSerif' color='green'>t</font>" );
- const std::string result3( "<font face='FreeSerif' style='Bold' size='16' color='red'><i><u>Styled</u></i></font><font face='FreeSerif' style='Bold' size='16' color='red'><i> Text</i></font><br />" );
- const std::string result4( "<font face='FreeSerif' size='14' color='0xaadd8744'><b><u>Styled</u></b></font><font face='FreeSerif' size='14' color='0xaadd8744'><b> Te</b></font><font face='FreeSerif' size='20' color='0xaadd8744'><b>x</b></font><font face='FreeSerif' size='14' color='0xaadd8744'><b>t</b></font><br />" );
- const std::string result5( "<shadow color='blue' paramx='1' paramy='0.75'>Shadow</shadow><br />" );
- const std::string result6( "<smooth param='0.75'><glow color='red' param='0.1'>Glow</glow></smooth><br />" );
- const std::string result7( "<font color='green'><outline color='red' paramx='0.7' paramy='0.7'>Outline</outline></font><br />" );
- const std::string result8( "<smooth param='0.75'>Smooth</smooth><br />" );
- const std::string result9( text9 );
- const std::string result10( text10 );
- const std::string result11( "<br />" );
-
- 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( "<font color='green'><i>Text with no defined style</i></font>" );
- const std::string result2( "Text with <font color='green'><i>no defined</i></font> 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( "<font color='0xFF000000'>black</font>" ),
- std::string( "<font color='black'>black</font>" )
- },
- {
- std::string( "<font color='0xFFFFFFFF'>white</font>" ),
- std::string( "white" )
- },
- {
- std::string( "<font color='0xFFFF0000'>red</font>" ),
- std::string( "<font color='red'>red</font>" )
- },
- {
- std::string( "<font color='0xFF00FF00'>green</font>" ),
- std::string( "<font color='green'>green</font>" )
- },
- {
- std::string( "<font color='0xFF0000FF'>blue</font>" ),
- std::string( "<font color='blue'>blue</font>" )
- },
- {
- std::string( "<font color='0xFFFFFF00'>yellow</font>" ),
- std::string( "<font color='yellow'>yellow</font>" )
- },
- {
- std::string( "<font color='0xFFFF00FF'>magenta</font>" ),
- std::string( "<font color='magenta'>magenta</font>" )
- },
- {
- std::string( "<font color='0xFF00FFFF'>cyan</font>" ),
- std::string( "<font color='cyan'>cyan</font>" )
- },
- {
- std::string( "<font color='0x00000000'>transparent</font>" ),
- std::string( "<font color='transparent'>transparent</font>" )
- },
- {
- std::string( "<font color='#000000'>black</font>" ),
- std::string( "<font color='black'>black</font>" )
- },
- {
- std::string( "<font color='#FFFFFF'>white</font>" ),
- std::string( "white" )
- },
- {
- std::string( "<font color='#FF0000'>red</font>" ),
- std::string( "<font color='red'>red</font>" )
- },
- {
- std::string( "<font color='#00FF00'>green</font>" ),
- std::string( "<font color='green'>green</font>" )
- },
- {
- std::string( "<font color='#0000FF'>blue</font>" ),
- std::string( "<font color='blue'>blue</font>" )
- },
- {
- std::string( "<font color='#FFFF00'>yellow</font>" ),
- std::string( "<font color='yellow'>yellow</font>" )
- },
- {
- std::string( "<font color='#FF00FF'>magenta</font>" ),
- std::string( "<font color='magenta'>magenta</font>" )
- },
- {
- std::string( "<font color='#00FFFF'>cyan</font>" ),
- std::string( "<font color='cyan'>cyan</font>" )
- },
- {
- std::string( "<font color='#000'>black</font>" ),
- std::string( "<font color='black'>black</font>" )
- },
- {
- std::string( "<font color='#FFF'>white</font>" ),
- std::string( "white" )
- },
- {
- std::string( "<font color='#F00'>red</font>" ),
- std::string( "<font color='red'>red</font>" )
- },
- {
- std::string( "<font color='#0F0'>green</font>" ),
- std::string( "<font color='green'>green</font>" )
- },
- {
- std::string( "<font color='#00F'>blue</font>" ),
- std::string( "<font color='blue'>blue</font>" )
- },
- {
- std::string( "<font color='#FF0'>yellow</font>" ),
- std::string( "<font color='yellow'>yellow</font>" )
- },
- {
- std::string( "<font color='#F0F'>magenta</font>" ),
- std::string( "<font color='magenta'>magenta</font>" )
- },
- {
- std::string( "<font color='#0FF'>cyan</font>" ),
- std::string( "<font color='cyan'>cyan</font>" )
- },
- {
- std::string( "<font color='0x000000'>black</font>" ),
- std::string( "<font color='black'>black</font>" )
- },
- {
- std::string( "<font color='black'>black</font>" ),
- std::string( "<font color='black'>black</font>" )
- },
- {
- std::string( "<font color='white'>white</font>" ),
- std::string( "white" )
- },
- {
- std::string( "<font color='red'>red</font>" ),
- std::string( "<font color='red'>red</font>" )
- },
- {
- std::string( "<font color='0xFF00FF00'>green</font>" ),
- std::string( "<font color='green'>green</font>" )
- },
- {
- std::string( "<font color='blue'>blue</font>" ),
- std::string( "<font color='blue'>blue</font>" )
- },
- {
- std::string( "<font color='yellow'>yellow</font>" ),
- std::string( "<font color='yellow'>yellow</font>" )
- },
- {
- std::string( "<font color='magenta'>magenta</font>" ),
- std::string( "<font color='magenta'>magenta</font>" )
- },
- {
- std::string( "<font color='cyan'>cyan</font>" ),
- std::string( "<font color='cyan'>cyan</font>" )
- },
- {
- std::string( "<font color='transparent'>transparent</font>" ),
- std::string( "<font color='transparent'>transparent</font>" )
- },
- {
- std::string( "<outline color='white'>outline</outline>" ),
- std::string( "<outline color='white'>outline</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 );
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
-#include <dali-toolkit/public-api/controls/alignment/alignment.h>
-
-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( "Hel<font size='10'>lo wo</font>rld!\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::Type>( Alignment::HorizontalLeft | Alignment::VerticalTop ),
- static_cast<Alignment::Type>( Alignment::HorizontalLeft | Alignment::VerticalCenter ),
- static_cast<Alignment::Type>( Alignment::HorizontalLeft | Alignment::VerticalBottom ),
- static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalTop ),
- static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalCenter ),
- static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalBottom ),
- static_cast<Alignment::Type>( Alignment::HorizontalRight | Alignment::VerticalTop ),
- static_cast<Alignment::Type>( Alignment::HorizontalRight | Alignment::VerticalCenter ),
- static_cast<Alignment::Type>( 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::Type>( Alignment::HorizontalCenter | Alignment::VerticalTop ) );
- textView.SetLineJustification( TextView::Center );
- textView.SetSize( 136.56252f, 100.f );
-
- textView.SetText( "Hel<font color='green'>lo wo</font>rld!" );
-
- application.SendNotification();
- application.Render();
-
- std::vector<Size> 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<Vector3> 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::Type>( 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( "Hel<font color='green'>lo world!</font> This <font color='green'>is</font> a sna<font color='green'>psho</font>t 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( "<u><font size='10'>gg<font size='14'>gg<font size='18'>gg<font size='22'>gg</font>gg</font>gg</font>gg</font></u>" );
- textView.SetSnapshotModeEnabled( false );
-
- textView.SetSize( 150.f, 100.f );
-
- Stage::GetCurrent().Add( textView );
-
- application.SendNotification();
- application.Render();
-
- std::vector<float> 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 );
- }
-}
+++ /dev/null
-utc-Dali-Alignment
-utc-Dali-ToolBar
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-ToolBar \
+++ /dev/null
-/dali-test-suite/toolbar/utc-Dali-ToolBar
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-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<Alignment::Type>( 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);
-}
+++ /dev/null
-utc-Dali-CubeTransitionEffect
-utc-Dali-CubeTransitionWaveEffect
-utc-Dali-CubeTransitionCrossEffect
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-CubeTransitionEffect \
+++ /dev/null
-/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-
-#include <dali-toolkit/public-api/transition-effects/cube-transition-effect.h>
-#include <dali-toolkit/public-api/transition-effects/cube-transition-wave-effect.h>
-#include <dali-toolkit/public-api/transition-effects/cube-transition-cross-effect.h>
-#include <dali-toolkit/public-api/transition-effects/cube-transition-fold-effect.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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<int>(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<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<float>(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<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<float>(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 );
-}
+++ /dev/null
-utc-Dali-UIBuilder
+++ /dev/null
-TARGETS += \
- utc-Dali-UIBuilder \
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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);
- }
-}
-
+++ /dev/null
-utc-Dali-View
+++ /dev/null
-../master-makefile.mk
\ No newline at end of file
+++ /dev/null
-TARGETS += \
- utc-Dali-View \
+++ /dev/null
-/dali-test-suite/view/utc-Dali-View
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <tet_api.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-toolkit/public-api/controls/view/view.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-
-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 );
-}
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
-#define __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// INTERNAL INCLUDES
-#include <dali-test-suite-utils.h>
-
-#include "toolkit-test-application.h"
-#include "toolkit-application.h"
-
-#endif // __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "toolkit-accessibility-manager.h"
-
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-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
+++ /dev/null
-#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
-#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// PUBLIC INCLUDES
-#include <dali/public-api/adaptor-framework/common/accessibility-manager.h>
-
-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__
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "toolkit-adaptor.h"
-
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/common/map-wrapper.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-namespace Dali
-{
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Stub for RenderSurface
- */
-class RenderSurface
-{
-};
-
-typedef Dali::Rect<int> PositionSize;
-
-/**
- * Stub for the Adaptor
- */
-class Adaptor
-{
-public:
-
- typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2;
-
- typedef std::pair<std::string, Dali::BaseHandle> SingletonPair;
- typedef std::map<std::string, Dali::BaseHandle> SingletonContainer;
- typedef SingletonContainer::const_iterator SingletonConstIter;
-
-public:
-
- Adaptor(ToolkitAdaptor& toolkitAdaptor);
- ~Adaptor();
-
-public:
-
- void Start();
- void Pause();
- void Resume();
- void Stop();
- bool AddIdle(boost::function<void(void)> 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<void(void)> 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
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
-#define __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/events/touch-point.h>
-#include <dali/public-api/math/rect.h>
-
-#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<int> 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<void(void)> 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<void(void)> 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__
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "toolkit-application.h"
-
-#include <boost/any.hpp>
-
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-#include <dali/public-api/adaptor-framework/common/orientation.h>
-
-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
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
-#define __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-namespace Dali
-{
-
-class Application;
-
-/**
- * This creates a stubbed Application so that Application calls work.
- * Furthermore, it provides an interface to see if certain methods were invoked.
- */
-class ToolkitApplication
-{
-public: // Construction & Destruction
-
- ToolkitApplication();
- ~ToolkitApplication();
-
-public: // Getters
-
- Application& GetApplication();
-
-public: // Signal Emissions
-
-public: // TEST FUNCTIONS
-
- // Enumeration of Application methods
- enum TestFuncEnum
- {
- };
-
- void Reset()
- {
- mFunctionsCalled.Reset();
- }
-
- bool WasCalled(TestFuncEnum func)
- {
- switch(func)
- {
- }
- return false;
- }
-
- void ResetCallStatistics(TestFuncEnum func)
- {
- switch(func)
- {
- }
- }
-
-private:
-
- struct TestFunctions
- {
- TestFunctions()
- {
- }
-
- void Reset()
- {
- }
- };
-
- TestFunctions mFunctionsCalled;
-
- // The Application Stub
- Application* mApplicationStub;
- friend class Application;
-};
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "toolkit-clipboard-event-notifier.h"
-
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-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
+++ /dev/null
-#ifndef __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__
-#define __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// PUBLIC INCLUDES
-#include <dali/public-api/adaptor-framework/common/clipboard-event-notifier.h>
-
-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__
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "toolkit-orientation.h"
-
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-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
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__
-#define __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/common/orientation.h>
-
-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__
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "toolkit-physical-keyboard.h"
-
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-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
+++ /dev/null
-#ifndef __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__
-#define __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// PUBLIC INCLUDES
-#include <dali/public-api/adaptor-framework/common/physical-keyboard.h>
-
-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__
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "toolkit-style-monitor.h"
-
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-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
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__
-#define __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/common/style-monitor.h>
-
-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__
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TEST_APPLICATION_H__
-#define __DALI_TOOLKIT_TEST_APPLICATION_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// INTERNAL INCLUDES
-#include <dali-test-suite-utils.h>
-
-#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__
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "toolkit-timer.h"
-// INTERNAL INCLUDES
-
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-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
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TOOLKIT_TIMER_H__
-#define __DALI_TOOLKIT_TOOLKIT_TIMER_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// PUBLIC INCLUDES
-#include <dali/public-api/adaptor-framework/common/timer.h>
-
-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__
+++ /dev/null
-#!/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 <<!EOF
-LD_LIBRARY_PATH=$TET_ROOT/lib/tet3:$LD_LIBRARY_PATH
-export LD_LIBRARY_PATH
-echo
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-echo
-gdb \$*
-!EOF
-
-chmod 755 $tmp_script
-tcc -v TET_EXEC_TOOL=$TET_ROOT/bin/tet_start -v TET_EXEC_FILE=$tmp_script -e -j - ./ $scenario
-
-unlink $tmp_script
+++ /dev/null
-#!/bin/sh
-
-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 <<!EOF
-LD_LIBRARY_PATH=$TET_ROOT/lib/tet3:$LD_LIBRARY_PATH
-export LD_LIBRARY_PATH
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-gdb \$*
-!EOF
-
-
-chmod 755 $tmp_script
-tcc -v TET_XTERM=/usr/bin/rxvt-xpm -v TET_XTERM_DISPLAY=192.168.129.2:0 -v TET_EXEC_TOOL=$TET_ROOT/bin/tet_start -v TET_EXEC_FILE=$tmp_script -e -j - ./ $scenario
-
-rm $tmp_script
#!/bin/bash
-TEMP=`getopt -o ds: --long desktop,scenario: \
- -n 'build_out.sh' -- "$@"`
-
-if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
-
-# Note the quotes around `$TEMP': they are essential!
-eval set -- "$TEMP"
-
-scenario=all
-env=./_export_env.sh
-
-while true ; do
- case "$1" in
- -d|--desktop) env=./_export_desktop.sh ; shift ;;
- -s|--scenario) scenario="$2" ; shift 2 ;;
- --) shift ; break ;;
- *) echo "Internal error!" ; exit 1 ;;
- esac
-done
-
-
-# Source correct environment
-. $env
-
-
-echo PATH=$PATH
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-echo TET_ROOT=$TET_ROOT
-echo TET_SUITE_ROOT=$TET_SUITE_ROOT
-echo ARCH=$ARCH
-
-RESULT_DIR=results-$ARCH
-HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir -p $RESULT_DIR
-
-tcc -e -j $JOURNAL_RESULT -p ./ $scenario
-./tbp.pl $JOURNAL_RESULT
-
+function execute
+{
+ scripts/tctestsgen.sh $1 `pwd` desktop
+ testkit-lite -f `pwd`/tests.xml -o tct-${1}-core-tests.xml -A --comm localhost
+ scripts/add_style.pl $1
+}
+
+# Clean up old test results
+rm -f tct*core-tests.xml
+
+if [ -n "$1" ] ; then
+ echo EXECUTING ONLY $1
+ execute $1
+
+else
+ for mod in `ls -1 src/ | grep -v CMakeList `
+ do
+ if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
+ echo EXECUTING $mod
+ execute $mod
+ fi
+ done
+fi
+
+scripts/summarize.pl
+++ /dev/null
-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
--- /dev/null
+%define MODULE_NAME dali-toolkit
+%define MODULE_LIBNAME dali-toolkit
+Name: core-%{MODULE_NAME}-tests
+Summary: Core API unit TC (%{name})
+Version: 0.1
+Release: 0
+Group: Development/Tools
+License: Apache License, Version 2.0, Samsung Properietary
+Source0: %{name}-%{version}.tar.gz
+Requires: dali
+Requires: dali-adaptor
+Requires: dali-toolkit
+BuildRequires: dali-integration-devel
+BuildRequires: pkgconfig(dali-core)
+BuildRequires: pkgconfig(dali)
+BuildRequires: pkgconfig(dali-toolkit)
+BuildRequires: libxml2-devel
+BuildRequires: cmake
+
+%description
+Core API unit TC (%{name})
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/%{name}"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+cd automated-tests
+cmake . -DMODULE="%{MODULE_NAME}" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+cd automated-tests
+%make_install
+mkdir -p %{buildroot}/opt/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/opt/usr/share/license/%{name}
+mkdir -p %{buildroot}/tmp/
+cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/add_all_smack_rule.sh %{buildroot}/tmp/
+cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/all_smack.rule %{buildroot}/tmp/
+
+%post
+
+%postun
+
+
+%files
+/opt/usr/bin/*
+/opt/usr/share/license/%{name}
+/tmp/add_all_smack_rule.sh
+/tmp/all_smack.rule
--- /dev/null
+%define MODULE_NAME dali-toolkit-unmanaged
+%define MODULE_LIBNAME dali-toolkit-unmanaged
+Name: core-%{MODULE_NAME}-tests
+Summary: Core API unit TC (%{name})
+Version: 0.1
+Release: 0
+Group: Development/Tools
+License: Apache License, Version 2.0, Samsung Properietary
+Source0: %{name}-%{version}.tar.gz
+Requires: dali
+Requires: dali-adaptor
+Requires: dali-toolkit
+BuildRequires: dali-integration-devel
+BuildRequires: pkgconfig(dali-core)
+BuildRequires: pkgconfig(dali)
+BuildRequires: pkgconfig(dali-toolkit)
+BuildRequires: libxml2-devel
+BuildRequires: cmake
+
+%description
+Core API unit TC (%{name})
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/%{name}"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+cd automated-tests
+cmake . -DMODULE="%{MODULE_NAME}" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+cd automated-tests
+%make_install
+mkdir -p %{buildroot}/opt/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/opt/usr/share/license/%{name}
+mkdir -p %{buildroot}/tmp/
+cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/add_all_smack_rule.sh %{buildroot}/tmp/
+cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/all_smack.rule %{buildroot}/tmp/
+
+%post
+
+%postun
+
+
+%files
+/opt/usr/bin/*
+/opt/usr/share/license/%{name}
+/tmp/add_all_smack_rule.sh
+/tmp/all_smack.rule
--- /dev/null
+%define MODULE_NAME dali-unmanaged
+%define MODULE_LIBNAME dali-unmanaged
+Name: core-%{MODULE_NAME}-tests
+Summary: Core API unit TC (%{name})
+Version: 0.1
+Release: 0
+Group: Development/Tools
+License: Apache License, Version 2.0, Samsung Properietary
+Source0: %{name}-%{version}.tar.gz
+Requires: dali
+BuildRequires: dali-devel
+BuildRequires: dali-integration-devel
+BuildRequires: pkgconfig(dali-core)
+BuildRequires: pkgconfig(dali)
+BuildRequires: libxml2-devel
+BuildRequires: cmake
+
+%description
+Core API unit TC (%{name})
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/%{name}"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+cd automated-tests
+cmake . -DMODULE="%{MODULE_NAME}" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+cd automated-tests
+%make_install
+mkdir -p %{buildroot}/opt/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/opt/usr/share/license/%{name}
+mkdir -p %{buildroot}/tmp/
+cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/add_all_smack_rule.sh %{buildroot}/tmp/
+cp %{_builddir}/%{name}-%{version}/automated-tests/scripts/all_smack.rule %{buildroot}/tmp/
+
+%post
+
+%postun
+
+
+%files
+/opt/usr/bin/*
+/opt/usr/share/license/%{name}
+/tmp/add_all_smack_rule.sh
+/tmp/all_smack.rule
+++ /dev/null
-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@
--- /dev/null
+#!/bin/sh
+
+SCRIPTDIR=`dirname $(readlink -f $0)`
+SMACK_FILE=$SCRIPTDIR/all_smack.rule
+
+echo ""
+echo "Add smack rule in $SMACK_FILE"
+echo "==================================================="
+echo ""
+
+while read rule; do
+ NO_BLANK=$(echo $rule | sed 's/ //g' | sed 's/ //g')
+ if [ ${#NO_BLANK} -lt 1 ]; then
+ echo "Blank"
+ continue
+ elif [ `echo $NO_BLANK|cut -c1-1` = '#' ]; then
+ echo "Comment"
+ continue
+ fi
+
+ echo "echo \"$rule\" > /smack/load2"
+ echo "$rule" > /smack/load2
+done < $SMACK_FILE
+
+echo "==================================================="
+echo ""
--- /dev/null
+#!/bin/sh
+
+SCRIPTDIR=`dirname $(readlink -f $0)`
+SMACK_FILE=$SCRIPTDIR/all_smack.rule
+
+echo ""
+echo "Add smack rule in $SMACK_FILE"
+echo "==================================================="
+
+echo "sdb root on"
+sdb root on
+
+while read rule; do
+ NO_BLANK=$(echo $rule | sed 's/ //g' | sed 's/ //g')
+ if [ ${#NO_BLANK} -lt 1 ]; then
+ #echo "Blank"
+ continue
+ elif [ `echo $NO_BLANK|cut -c1-1` = '#' ]; then
+ #echo "Comment"
+ continue
+ fi
+
+ echo "sdb shell \"echo $rule > /smack/load2\""
+ sdb shell "echo $rule > /smack/load2"
+done < $SMACK_FILE
+
+echo "==================================================="
+echo ""
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use Encode;
+use Getopt::Long;
+use Cwd;
+
+my $pwd = getcwd;
+my $MOD_NAME = $ARGV[0];
+my $results_xml = "tct-$MOD_NAME-core-tests.xml";
+my $results_out = "results_xml.$$";
+
+# Copy $results_xml, writing new stylesheet line:
+# Write <?xml-stylesheet type="text/xsl" href="./style/testresult.xsl"?> as second line
+open RESULTS, "<$results_xml" || die "Can't open $results_xml for reading:$!\n";
+open RESULTS_OUT, ">$results_out" || die "Can't open $results_out for writing:$!\n";
+my $fline = readline RESULTS;
+print RESULTS_OUT $fline;
+print RESULTS_OUT "<?xml-stylesheet type=\"text/xsl\" href=\"./style/testresult.xsl\"?>\n";
+while(<RESULTS>)
+{
+ print RESULTS_OUT $_;
+}
+close RESULTS_OUT;
+close RESULTS;
+unlink $results_xml;
+print `mv $results_out $results_xml`;
--- /dev/null
+# calendar-service
+_ calendar-service::svc rwx
+
+# capi-appfw-application
+_ alarm-server::alarm rw
+_ aul::launch x
+_ aul::terminate x
+
+# capi-network-bluetooth
+_ bt-service::admin w
+_ bt-service::manager w
+_ bt-service::gap w
+_ bt-service::spp w
+_ bt:service::opp w
+
+# capi-network-nfc
+_ nfc-manager rwx
+_ nfc-manager::tag rwx
+_ nfc-manager::p2p rwx
+_ nfc-manager::admin rwx
+_ nfc-manager::common rwx
+
+# capi-location-*
+_ location::maps rw
+_ location::client rw
+
+# libmdm
+_ mdm-server::eas rw
--- /dev/null
+#!/bin/bash
+if [ -z "$TC_PROJECT_DIR" ]; then
+ echo "CoreAPI project directory can't be found. `basename $0` exitting..."
+ exit 1
+fi
+
+_tcbuild () {
+ local cur
+ cur=${COMP_WORDS[$COMP_CWORD]}
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W "addmod build install rmmod" -- $cur ) )
+ else #if [ $COMP_CWORD -eq 2 ]; then
+ COMPREPLY=( $( cd $TC_PROJECT_DIR/src; compgen -d -X "common" -- $cur ) )
+ fi
+ return 0
+}
+
+complete -F _tcbuild tcbuild
--- /dev/null
+#!/bin/bash
+
+PROJECT_DIR="$(cd "$(dirname $0)" && cd .. && pwd)"
+
+ln -s $PROJECT_DIR/scripts/tcbuild.sh $PROJECT_DIR/tcbuild
+
+echo "" >> $HOME/.bashrc
+echo "# CoreAPI-tests convenience helpers" >> $HOME/.bashrc
+echo "export TC_PROJECT_DIR=\"$PROJECT_DIR\"" >> $HOME/.bashrc
+echo "source $PROJECT_DIR/scripts/autocompletion.sh" >> $HOME/.bashrc
--- /dev/null
+#!/bin/bash
+
+USAGE=$(cat <<EOF
+Usage note: retriever.sh [option] [directory]
+Options:
+ none retrieve TC names with corresponding startup and cleanup functions
+ -f retrieveve TC name with corresponding "set" and "purpose" clauses
+ -anum retrieve automatic TC number
+ -mnum retrieve manual TC number
+
+In case of TC in form of "int tc_name()" script will abort.
+("int tc_name(void)" is a proper function signature)
+EOF
+)
+
+function get_tc_files {
+ CMAKE_FILE="$DIR/CMakeLists.txt"
+ if [ ! -e $CMAKE_FILE ]; then
+ echo "File $CMAKE_FILE not found. Aborting..."
+ exit 1
+ fi
+
+ TC_FILES=$(cat $CMAKE_FILE | awk -vDIR="$DIR" '
+ BEGIN {
+ flag = 0;
+ files = "";
+ }
+ /^SET\(TC_SOURCES/ {
+ flag = 1;
+ next;
+ }
+ /\)/ {
+ if (flag == 1)
+ exit;
+ }
+ !/^ *#/ {
+ if (flag == 1) {
+ if (files == "")
+ files = DIR "/" $1;
+ else
+ files = files " " DIR "/" $1;
+ }
+ }
+ END {
+ print files;
+ }')
+}
+
+function tc_names {
+ if [[ -z "$1" ]]; then
+ exit
+ fi
+
+ awk '
+ BEGIN {
+ OFS = ",";
+ start_fun = "NULL";
+ clean_fun = "NULL";
+ err_flag = 0;
+ tc_list = "";
+ }
+ /^void .*startup\(void\)/ {
+ gsub(/^void /, "");
+ gsub(/\(void\)$/,"");
+ start_fun = $0
+ }
+ /^void .*cleanup\(void\)/ {
+ gsub(/^void /, "");
+ gsub(/\(void\)$/,"");
+ clean_fun = $0
+ }
+ /^int .*\(\)/ {
+ print "Warning: function with empty argument list -- \"" $0 "\" in " FILENAME ":" FNR;
+ err_flag = 1;
+ }
+ /^int .*\(void\)/ {
+ gsub(/^int /, "");
+ gsub(/\(void\).*/,"");
+ if (tc_list != "") tc_list = tc_list "\n";
+ tc_list = tc_list $0 OFS start_fun OFS clean_fun
+ }
+ END {
+ if (err_flag) {
+ exit 1
+ } else {
+ print tc_list
+ }
+ }
+ ' $*
+}
+
+function tc_anum {
+ awk '
+ BEGIN {
+ count = 0;
+ err_flag = 0;
+ }
+ /^int .*\(\)/ {
+ print "Warning: function with empty argument list -- \"" $0 "\" in " FILENAME ":" FNR;
+ err_flag = 1;
+ }
+ /^int .*\(void\)$/ {
+ count++;
+ }
+ END {
+ if (err_flag) {
+ exit 1
+ } else {
+ print count
+ }
+ }
+ ' $*
+}
+
+function tc_mnum {
+ # TODO: fix this hardcoded value
+ echo 0
+}
+
+function tc_fullinfo {
+ awk '
+ BEGIN {
+ OFS=",";
+ purpose = "";
+ set = "default";
+ err_flag = 0;
+ tc_list = "";
+ }
+ /^\/\/& set:/ {
+ set = $3;
+ next;
+ }
+ /^\/\/& purpose:/ {
+ purpose = $3;
+ for (i = 4; i <= NF; i++) {
+ purpose = purpose " " $i;
+ }
+ next;
+ }
+ /^int .*\(\)/ {
+ print "Warning: function with empty argument list -- \"" $0 "\" in " FILENAME ":" FNR;
+ err_flag = 1;
+ }
+ /^int .*\(void\)$/ {
+ gsub(/^int /, "");
+ gsub(/\(void\)$/,"");
+ if (tc_list != "") tc_list = tc_list "\n";
+ tc_list = tc_list $0 OFS set OFS purpose;
+ purpose = "";
+ next
+ }
+ END {
+ if (err_flag) {
+ exit 1
+ } else {
+ print tc_list
+ }
+ }
+ ' $*
+}
+
+
+# usage note and exit:
+# - argument begin with '-' but is not recognised or number of arguments is > 2,
+# - argument doesn't begin with '-' and number of arguments is > 1
+if [[ ( "$1" == -* && ( ! "$1" =~ ^-(anum|mnum|f)$ || $# > 2 ) ) || ( "$1" != -* && $# > 1 ) ]]; then
+ echo -e "$USAGE"
+ exit 1
+fi
+
+
+# get directory from last argument (or assume current one)
+if [[ ! "$1" =~ ^-(anum|mnum|f)$ ]]; then
+ DIR=${1:-.}
+else
+ DIR=${2:-.}
+fi
+
+
+# populate $TC_FILES with files declared in CMakeLists.txt
+get_tc_files $DIR
+if [ $? != 0 ]; then
+ exit 1
+fi
+
+
+# run appropriate subcommand
+case "$1" in
+ -anum)
+ tc_anum $TC_FILES ;;
+ -mnum)
+ tc_mnum $TC_FILES ;;
+ -f)
+ tc_fullinfo $TC_FILES ;;
+ *)
+ tc_names $TC_FILES ;;
+esac
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use XML::Parser;
+use Encode;
+use Getopt::Long;
+use Cwd;
+
+my $pwd = getcwd;
+my $num_tests=0;
+my $num_passes=0;
+my $num_actual_passes=0;
+my $text = "";
+
+sub handle_start
+{
+ my ($p, $elt, %attrs) = @_;
+
+ if($elt =~ /testcase/)
+ {
+ $num_tests++;
+ if($attrs{"result"} eq "PASS")
+ {
+ $num_passes++;
+ }
+ }
+ if($elt =~ /actual_result/)
+ {
+ $text = "";
+ }
+}
+
+sub handle_end
+{
+ my ($p, $elt) = @_;
+ if($elt =~ /actual_result/)
+ {
+ if($text eq "PASS")
+ {
+ $num_actual_passes++;
+ }
+ $text = "";
+ }
+}
+
+sub handle_char
+{
+ my ($p, $str) = @_;
+ $text .= $str;
+}
+
+my($parser) = new XML::Parser(Handlers => {Start => \&handle_start,
+ End => \&handle_end,
+ Char => \&handle_char});
+
+
+# Write summary.xml:
+open SUMMARY, ">summary.xml" || die "Can't open summary.xml for writing:$!\n";
+print SUMMARY << "EOS";
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="./style/summary.xsl"?>
+<result_summary plan_name="Core">
+ <other xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" />
+ <summary test_plan_name="Empty test_plan_name">
+ <start_at>2014-03-21_18_52_41</start_at>
+ <end_at>2014-03-21_18_57_54</end_at>
+ </summary>
+EOS
+
+print "\n\nSummary of all tests:\n";
+my $output_files = `ls tct*core-tests.xml`;
+my $file;
+foreach $file (split /\s+/, $output_files )
+{
+ $num_tests=0;
+ $num_passes=0;
+ $num_actual_passes=0;
+ $text = "";
+
+ $parser->parsefile($file);
+
+ my $pass_rate = sprintf("%5.2f", $num_passes * 100.0 / $num_tests);
+ my $num_fails = $num_tests - $num_passes;
+ my $fail_rate = sprintf("%5.2f", $num_fails * 100.0 / $num_tests);
+
+ my $suite_name = $file;
+ $suite_name =~ s/\.xml$//;
+
+ print "$suite_name: $num_passes tests passed out of $num_tests ( $pass_rate% )\n";
+
+print SUMMARY << "EOS2";
+ <suite name="$suite_name">
+ <total_case>$num_tests</total_case>
+ <pass_case>$num_passes</pass_case>
+ <pass_rate>$pass_rate</pass_rate>
+ <fail_case>$num_fails</fail_case>
+ <fail_rate>$fail_rate</fail_rate>
+ <block_case>0</block_case>
+ <block_rate>0.00</block_rate>
+ <na_case>0</na_case>
+ <na_rate>0.00</na_rate>
+ </suite>
+EOS2
+}
+
+print SUMMARY "</result_summary>\n";
+close SUMMARY;
+
+print "Summary of results written to summary.xml\n";
--- /dev/null
+#!/bin/bash
+
+#---------- DEBUG_BEGIN ----------
+#ARG="-d" # debug-on flag, might be set as $1
+# keyprompt "introductory message" -- wait until any key pressed
+function keyprompt { echo -ne "\n\e[1;31m$1 -- " && read -n 1 && echo -e "\n\e[0m"; }
+# d_bp -- breakpoint at which user need to press any key to proceed
+function d_bp { if [[ "$ARG" == "-d" ]]; then keyprompt "d >> Press any key"; fi }
+# d_showVar VARNAME -- print bash variable name
+function d_showVar { if [ "$ARG" == "-d" -a -n "$1" ]; then echo "d >> ${1} = ${!1}"; fi }
+# d_print "message" -- print a debug message
+function d_print { if [ "$ARG" == "-d" -a -n "$1" ]; then echo -e "d >> $1"; fi }
+#---------- DEBUG_END ----------
+
+PROJECT_DIR="$(cd "$(dirname $0)" && pwd)"
+d_showVar PROJECT_DIR
+
+function gbs_profile {
+perl -e "
+use Config::Tiny;
+my \$Config = Config::Tiny->read( \"\$ENV{HOME}/.gbs.conf\" );
+my \$profile = \$Config->{general}->{profile};
+\$profile =~ s/profile.//;
+print \$profile;"
+}
+
+PROFILE=`gbs_profile`
+RPM_DIR="$HOME/GBS-ROOT/local/repos/$PROFILE/armv7l/RPMS"
+d_showVar RPM_DIR
+
+function add_module {
+ # argument check
+ if [ -z "$1" ]; then echo "Usage: `basename $0` addmod <module_name> [module_lib_name]"; exit 1; fi
+
+ MODULE_NAME=$1
+ d_showVar MODULE_NAME
+ MODULE_NAME_C=$(echo $MODULE_NAME | sed -e 's/-\([a-z]\)/\U\1/' -e 's/^\([a-z]\)/\U\1/')
+ d_showVar MODULE_NAME_C
+ MODULE_NAME_U=$(echo $MODULE_NAME | sed -e 's/-/_/')
+ d_showVar MODULE_NAME_U
+# MODULE_LIBNAME=${2:-capi-$MODULE_NAME}
+ MODULE_LIBNAME=$1
+ d_showVar MODULE_LIBNAME
+
+ echo "Adding $MODULE_NAME module to project..."
+ d_bp
+ cd $PROJECT_DIR
+ # prepare .spec file
+ echo "-- Generating packaging/core-$MODULE_NAME-tests.spec file"
+ if [ ! -d packaging ]; then mkdir packaging; fi
+ sed -e "s:\[MODULE_NAME\]:$MODULE_NAME:g" -e "s:\[MODULE_LIBNAME\]:$MODULE_LIBNAME:g" \
+ templates/core-\[module_name\]-tests.spec > packaging/core-$MODULE_NAME-tests.spec
+ # prepare src directory
+ mkdir src/$MODULE_NAME
+ echo "-- Generating src/$MODULE_NAME/CMakeLists.txt file"
+ sed -e "s:%{MODULE_NAME}:$MODULE_NAME:g" -e "s:%{MODULE_LIBNAME}:$MODULE_LIBNAME:g" \
+ templates/src-directory/CMakeLists.txt > src/$MODULE_NAME/CMakeLists.txt
+ echo "-- Generating src/$MODULE_NAME/tct-$MODULE_NAME-core.c file"
+ sed -e "s:%{MODULE_NAME}:$MODULE_NAME:g" \
+ templates/src-directory/tct-\[module_name\]-core.c > src/$MODULE_NAME/tct-$MODULE_NAME-core.c
+ echo "-- Generating src/$MODULE_NAME/utc-$MODULE_NAME.c file"
+ sed -e "s:%{MODULE_NAME_U}:$MODULE_NAME_U:g" -e "s:%{MODULE_NAME_C}:$MODULE_NAME_C:g" \
+ templates/src-directory/utc-\[module_name\].c > src/$MODULE_NAME/utc-$MODULE_NAME.c
+ echo "Task finished successfully"
+}
+
+function rm_module {
+ # argument check
+ if [ -z "$1" ]; then echo "Usage: `basename $0` rmmod <module_name>"; exit 1; fi
+
+ MODULE_NAME=$1
+ d_showVar MODULE_NAME
+
+ echo "Removing $MODULE_NAME module from project..."
+ d_bp
+ echo "---- Updating /opt/tct/packages/package_list.xml"
+ scripts/tcpackageslistsgen.sh $MODULE_NAME /opt/tct/packages/package_list.xml 1
+ if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+ # echo "---- Updating test plans"
+ # scripts/tcpackageslistsgen.sh $MODULE_NAME /opt/tct/manager/plan/*.xml 1
+ # if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+
+ cd $PROJECT_DIR
+ echo "-- Removing packaging/core-$MODULE_NAME-tests.spec file"
+ rm packaging/core-$MODULE_NAME-tests.spec
+ echo "-- Removing src/$MODULE_NAME directory"
+ rm -r src/$MODULE_NAME
+ echo "Task finished successfully"
+}
+
+function build {
+ if [ -n "$1" ]; then
+ (cd src/$1; ../../scripts/tcheadgen.sh tct-$1-core.h)
+ if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+ cp packaging/core-$1-tests.spec ../packaging
+ gbs build -A armv7l --spec core-$1-tests.spec --include-all --keep-packs | \
+ tee build.log | stdbuf -o0 sed -e 's/error:/\x1b[1;91m&\x1b[0m/' \
+ -e 's/warning:/\x1b[93m&\x1b[0m/'
+ rm ../packaging/core-$1-tests.spec
+ else
+ echo "Build requires a module name"
+ exit 1
+ fi
+}
+
+function inst {
+ if [ -z "$1" ]
+ then
+ for mod in `ls -1 src/ | grep -v CMakeLists`
+ do
+
+ if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
+
+ PKG_NAME="core-$mod-tests"
+ d_showVar PKG_NAME
+ VER=$(cat packaging/$PKG_NAME.spec | awk '/^Version:/ { print $2; exit; }')
+ d_showVar VER
+ PKG_VNAME="$PKG_NAME-$VER"
+ d_showVar PKG_VNAME
+ PKG_FNAME="$PKG_VNAME-0.armv7l.rpm"
+ d_showVar PKG_FNAME
+
+ if [ -f "$RPM_DIR/$PKG_FNAME" ]
+ then
+ inst $mod
+ echo ""
+ fi
+ fi
+ done
+ else
+ cd $PROJECT_DIR
+ # setting variables
+ MOD_NAME="$1"
+ d_showVar MOD_NAME
+ PKG_NAME="core-$MOD_NAME-tests"
+ d_showVar PKG_NAME
+ VER=$(cat packaging/$PKG_NAME.spec | awk '/^Version:/ { print $2; exit; }')
+ d_showVar VER
+ PKG_VNAME="$PKG_NAME-$VER"
+ d_showVar PKG_VNAME
+ PKG_FNAME="$PKG_VNAME-0.armv7l.rpm"
+ d_showVar PKG_FNAME
+ TCT_DIR="opt/tct-$MOD_NAME-core-tests"
+ d_showVar TCT_DIR
+
+ echo "Deploying $MOD_NAME suite to tct-mgr..."
+ d_bp
+ # prepare tct directory and files
+ echo "-- Preparing suite .zip file..."
+ echo "---- Creating /tmp/$TCT_DIR directory"
+ rm -r /tmp/opt > /dev/null 2>&1
+ mkdir -p /tmp/$TCT_DIR
+ # README
+ echo "---- Copying /tmp/$TCT_DIR"
+ cp templates/tct-package/README /tmp/$TCT_DIR
+ # rpm
+ echo "---- Copying /tmp/$TCT_DIR package"
+ cp $RPM_DIR/$PKG_FNAME /tmp/$TCT_DIR
+ if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+ # inst.sh
+ echo "---- Generating /tmp/$TCT_DIR/inst.sh file"
+ sed -e "s:%{PKG_NAME}:\"$PKG_NAME\":g" -e "s:%{PKG_FULLNAME}:\"$PKG_FNAME\":g" \
+ -e "s:%{PKG_DIR}:\"/opt/usr/media/tct/$TCT_DIR\":g" \
+ templates/tct-package/inst.sh > /tmp/$TCT_DIR/inst.sh
+ chmod a+x /tmp/$TCT_DIR/inst.sh
+ # tests.xml
+ echo "---- Generating /tmp/$TCT_DIR"
+ scripts/tctestsgen.sh $MOD_NAME /tmp/$TCT_DIR target
+ if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+ # zip
+ echo "---- Preparing /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip file"
+ # clear old zips
+ rm -r /tmp/tct/packages > /dev/null 2>&1
+ mkdir -p /tmp/tct/packages
+ # create new zip
+ ( cd /tmp; zip -r /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip opt > /dev/null 2>&1; )
+ # deployment
+ echo "-- Suite deployment..."
+ echo "---- Copying /opt/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip"
+ cp /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip /opt/tct/packages/
+ echo "---- Updating /opt/tct/packages/package_list.xml"
+ scripts/tcpackageslistsgen.sh $MOD_NAME /opt/tct/packages/package_list.xml 0
+ if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+ # echo "---- Updating test plans"
+ # for file in `grep -r tct-$MOD_NAME-core-tests /opt/tct/manager/plan/ | cut -d: -f1 | uniq`
+ # do
+ # scripts/tcpackageslistsgen.sh $MOD_NAME $file
+ # done
+ # scripts/tcpackageslistsgen.sh $MOD_NAME /opt/tct/manager/plan/Full_test.xml
+ # if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+ echo "Task finished successfully"
+ fi
+}
+
+if [ -z "$1" ]; then
+ # usage note
+ echo "Usage: `basename $0` <addmod|rmmod|build|install> <module_name> [module_lib_name]"
+ exit 1
+elif [ "addmod" == "$1" ]; then
+ # add new module
+ add_module $2 $3
+elif [ "rmmod" == "$1" ]; then
+ # remove module
+ rm_module $2
+elif [ "build" == "$1" ]; then
+ # build the binary
+ build $2
+elif [ "install" == "$1" ]; then
+ # install
+ inst $2
+else
+ echo "Invalid subcommand: $1"
+fi
--- /dev/null
+#!/bin/bash
+
+if [[ -z $1 ]]; then
+ echo "Usage note: tcheadgen.sh <header_filename.h>"
+ exit 1
+fi
+
+FILE="$PWD/$1"
+TFILE="/tmp/retr.csv"
+HEADER_NAME=$(echo $1 | tr '[:lower:]' '[:upper:]' | sed -e 's/-/_/g' -e 's/\./_/')
+SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)"
+
+$SCRIPT_DIR/retriever.sh > $TFILE
+if [ $? -ne 0 ]; then cat $TFILE; exit 1; fi
+awk -F',' -v HEADER_NAME="$HEADER_NAME" '
+ BEGIN {
+ OFS = ", ";
+
+ startup_counter = 0;
+ startup_list[0] = "";
+
+ cleanup_counter = 0;
+ cleanup_list[0] = "";
+
+ testcase_counter = 0;
+ testcase_list[0] = "";
+
+ tc_array_counter = 0;
+ tc_array_list[0] = "";
+
+print "#ifndef __" HEADER_NAME "__"
+print "#define __" HEADER_NAME "__"
+print ""
+print "#include \"testcase.h\""
+print ""
+ }
+ {
+ testcase_list[testcase_counter++] = $1;
+
+ if (startup_counter == 0 || startup_list[startup_counter-1] != $2)
+ startup_list[startup_counter++] = $2;
+
+ if (startup_counter == 0 || cleanup_list[cleanup_counter-1] != $3)
+ cleanup_list[cleanup_counter++] = $3;
+
+ tc_array_list[tc_array_counter++] = "\"" $1 "\", " $1 ", " $2 ", " $3;
+ }
+ END {
+ sc_count = (startup_counter > cleanup_counter) ? startup_counter : cleanup_counter;
+ for (i = 0; i < sc_count; i++) {
+ if (i < startup_counter && startup_list[i] != "NULL")
+print "extern void " startup_list[i] "(void);"
+ if (i < cleanup_counter && cleanup_list[i] != "NULL")
+print "extern void " cleanup_list[i] "(void);"
+ }
+
+print ""
+ for (i = 0; i < testcase_counter; i++)
+print "extern int " testcase_list[i] "(void);"
+
+print ""
+print "testcase tc_array[] = {"
+
+ for (i = 0; i < tc_array_counter; i++)
+print " {" tc_array_list[i] "},"
+
+print " {NULL, NULL}"
+print "};"
+print ""
+print "#endif // __" HEADER_NAME "__"
+}' $TFILE > $FILE
--- /dev/null
+#!/bin/bash
+
+if [ -z $1 -o -z $2 ]; then
+ echo "Usage note: tcpackageslistsgen.sh <module_name> <output_file.xml>"
+ exit 1
+fi
+
+MODULE_NAME=$1
+FILE=$2
+if [ ! -f $FILE ]; then
+ echo "No such file: $2"
+ exit
+fi
+SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)"
+AUTO_NUM=$(cd $SCRIPT_DIR/..; scripts/retriever.sh -anum src/$MODULE_NAME)
+if [ $? -ne 0 ]; then echo $AUTO_NUM; exit 1; fi
+MAN_NUM=$(cd $SCRIPT_DIR/..; scripts/retriever.sh -mnum src/$MODULE_NAME)
+if [ $? -ne 0 ]; then echo $MAN_NUM; exit 1; fi
+
+TFILE="/tmp/tempfile.xml"
+if [ -f $TFILE ]; then
+ rm $TFILE
+fi
+
+function regen {
+ awk -v RS='\r\n' -v ORS='\r\n' -v MODULE_NAME=$MODULE_NAME -v AUTO_NUM=$AUTO_NUM -v MAN_NUM=$MAN_NUM '
+ BEGIN {
+ found = 0;
+ replaced = 0;
+ }
+ $0 ~ "<suite name=\"tct-" MODULE_NAME "-core-tests\" category=\"Core APIs\">" {
+ found = 1;
+ next
+ }
+ /<\/suite>/ {
+ if (found == 1) {
+print " <suite name=\"tct-" MODULE_NAME "-core-tests\" category=\"Core APIs\">";
+print " <auto_tcn>" AUTO_NUM "</auto_tcn>";
+print " <manual_tcn>" MAN_NUM "</manual_tcn>";
+print " <total_tcn>" AUTO_NUM+MAN_NUM "</total_tcn>";
+print " <pkg_name>tct-" MODULE_NAME "-core-tests-2.2.1-1.zip</pkg_name>";
+print " </suite>";
+ found = 0;
+ replaced = 1;
+ } else {
+ print $0;
+ }
+ next
+ }
+ /<\/ns3:testplan>/ {
+ if (replaced == 0) {
+print " <suite name=\"tct-" MODULE_NAME "-core-tests\" category=\"Core APIs\">";
+print " <auto_tcn>" AUTO_NUM "</auto_tcn>";
+print " <manual_tcn>" MAN_NUM "</manual_tcn>";
+print " <total_tcn>" AUTO_NUM+MAN_NUM "</total_tcn>";
+print " <pkg_name>tct-" MODULE_NAME "-core-tests-2.2.1-1.zip</pkg_name>";
+print " </suite>";
+print $0
+ } else {
+ print $0
+ }
+ next
+ }
+ {
+ if (found == 0) {
+ print $0;
+ }
+ }' $FILE > $TFILE
+ cat $TFILE > $FILE
+}
+
+regen
--- /dev/null
+#!/bin/bash
+
+if [[ -z $1 ]]; then
+ echo "Usage note: tctestsgen.sh <module_name>"
+ exit 1
+fi
+
+MODULE_NAME=$1
+MODULE_NAME_C=$(echo $MODULE_NAME | sed -e 's/-\([a-z]\)/\U\1/' -e 's/^\([a-z]\)/\U\1/')
+SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)"
+TC_DIR="/opt/usr/bin/tct-$1-core"
+if [[ $3 == "desktop" ]] ; then
+ TC_DIR="build/src/$1"
+fi
+
+FILE="$2/tests.xml"
+if [ -a $FILE ]; then
+ rm $FILE
+fi
+TFILE="/tmp/tcs.csv"
+if [ -a $TFILE ]; then
+ rm $TFILE
+fi
+
+function gen {
+ awk -F',' -v MODULE_NAME=$MODULE_NAME -v MODULE_NAME_C=$MODULE_NAME_C -v TC_DIR=$TC_DIR '
+ BEGIN {
+ set = ""
+print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+print " <?xml-stylesheet type=\"text/xsl\" href=\"./testcase.xsl\"?>";
+print "<test_definition>";
+print " <suite name=\"tct-"MODULE_NAME"-core-tests\" category=\"Core APIs\">";
+ }
+ {
+ if (set != "" && set != $2) {
+print " </set>"
+ }
+
+ if (set != $2) {
+ set = $2;
+print " <set name=\"" set "\">";
+ }
+
+ tcname = $1;
+ tcpurpose = $3
+
+print " <testcase component=\"CoreAPI/" MODULE_NAME_C "/" set "\" execution_type=\"auto\" id=\"" tcname "\" purpose=\"" tcpurpose "\">";
+print " <description>";
+
+print " <test_script_entry test_script_expected_result=\"0\">" TC_DIR "/tct-" MODULE_NAME "-core " tcname "</test_script_entry>";
+print " </description>";
+print " </testcase>";
+ }
+ END {
+ if (set != "") {
+print " </set>"
+ }
+print " </suite>"
+print "</test_definition>"
+ }' $TFILE > $FILE
+}
+
+(cd $SCRIPT_DIR/..; scripts/retriever.sh -f src/$MODULE_NAME > ${TFILE}_pre)
+if [ $? -ne 0 ]; then cat ${TFILE}_pre; exit 1; fi
+cat ${TFILE}_pre | sort -t',' -k2,2 -s > $TFILE
+gen
--- /dev/null
+IF( DEFINED MODULE )
+ MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}")
+ ADD_SUBDIRECTORY(${MODULE})
+ELSE( DEFINED MODULE )
+ MESSAGE(FATAL_ERROR "No module selected to build. Aborting...")
+ENDIF( DEFINED MODULE )
--- /dev/null
+#ifndef _ASSERT_H_
+#define _ASSERT_H_
+#include <stdio.h>
+#include <stdlib.h>
+
+#define assert(exp) \
+ if (!(exp)) { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(stderr, \
+ "Following expression is not true:\n" \
+ "%s\n", #exp); \
+ return 1; \
+ }
+
+#define assert_eq(var, ref) \
+ if (var != ref) { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(stderr, \
+ "Values \"%s\" and \"%s\" are not equal:\n" \
+ "%s == %d, %s == %d\n", \
+ #var, #ref, #var, (int)var, #ref, (int)ref); \
+ return 1; \
+ }
+
+#define assert_neq(var, ref) \
+ if (var == ref) { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(stderr, \
+ "Values \"%s\" and \"%s\" are equal:\n" \
+ "%s == %s == %d\n", \
+ #var, #ref, #var, #ref, (int)ref); \
+ return 1; \
+ }
+
+#define assert_gt(var, ref) \
+ if (var <= ref) { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(stderr, \
+ "Value \"%s\" is not greater than \"%s\":\n" \
+ "%s == %d, %s == %d\n", \
+ #var, #ref, #var, var, #ref, ref); \
+ return 1; \
+ }
+
+#define assert_geq(var, ref) \
+ if (var < ref) { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(stderr, \
+ "Value \"%s\" is not greater or equal to \"%s\":\n" \
+ "%s == %d, %s == %d\n", \
+ #var, #ref, #var, var, #ref, ref); \
+ return 1; \
+ }
+
+#define assert_lt(var, ref) \
+ if (var >= ref) { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(stderr, \
+ "Value \"%s\" is not lower than \"%s\":\n" \
+ "%s == %d, %s == %d\n", \
+ #var, #ref, #var, var, #ref, ref); \
+ return 1; \
+ }
+
+#define assert_leq(var, ref) \
+ if (var > ref) { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(stderr, \
+ "Value \"%s\" is not lower or equal to \"%s\":\n" \
+ "%s == %d, %s == %d\n", \
+ #var, #ref, #var, var, #ref, ref); \
+ return 1; \
+ }
+
+#endif // _ASSERT_H_
--- /dev/null
+#ifndef _TESTCASE_H_
+#define _TESTCASE_H_
+
+/* pointer to startup/cleanup functions */
+typedef void (*void_fun_ptr)(void);
+
+/* pointer to testcase functions */
+typedef int (*tc_fun_ptr)(void);
+
+/* struct describing specific testcase */
+typedef struct testcase_s {
+ const char* name;
+ tc_fun_ptr function;
+ void_fun_ptr startup;
+ void_fun_ptr cleanup;
+} testcase;
+
+#endif // _TESTCASE_H_
--- /dev/null
+SET(PKG_NAME "dali-toolkit-internal")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-core")
+SET(RPM_NAME "core-${PKG_NAME}-tests")
+
+SET(CAPI_LIB "dali-toolkit-internal")
+
+# List of test case sources (Only these get parsed for test cases)
+SET(TC_SOURCES
+ utc-Dali-PushButton.cpp
+ utc-Dali-TextView-HelperAndDebug.cpp
+ utc-Dali-TextView-Processor-Types.cpp
+ utc-Dali-TextView-Processor.cpp
+ utc-Dali-TextView-Relayout-Utilities.cpp
+ utc-Dali-TextView.cpp
+)
+
+# Append list of test harness files (Won't get parsed for test cases)
+LIST(APPEND TC_SOURCES
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
+)
+
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ dali-core
+ dali
+ dali-toolkit
+)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type")
+
+FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS})
+ SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}")
+ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS})
+
+INCLUDE_DIRECTORIES(
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+ ../dali-toolkit/dali-toolkit-test-utils
+ ../../..
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${EXEC_NAME}
+)
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include "tct-dali-toolkit-internal-core.h"
+
+int main(int argc, const char *argv[])
+{
+ int result = -1;
+ int i;
+
+ if (argc != 2) {
+ printf("Usage: %s <testcase name>\n", argv[0]);
+ return 2;
+ }
+
+ for (i = 0; tc_array[i].name; i++) {
+ if (!strcmp(argv[1], tc_array[i].name)) {
+ if (tc_array[i].startup)
+ tc_array[i].startup();
+
+ result = tc_array[i].function();
+
+ if (tc_array[i].cleanup)
+ tc_array[i].cleanup();
+
+ return result;
+ }
+ }
+
+ printf("Unknown testcase name: \"%s\"\n", argv[1]);
+ return 2;
+}
--- /dev/null
+#ifndef __TCT_DALI_TOOLKIT_INTERNAL_CORE_H__
+#define __TCT_DALI_TOOLKIT_INTERNAL_CORE_H__
+
+#include "testcase.h"
+
+extern void dali_text_view_helper_and_debug_startup(void);
+extern void dali_text_view_helper_and_debug_cleanup(void);
+extern void dali_text_view_processor_types_startup(void);
+extern void dali_text_view_processor_types_cleanup(void);
+extern void dali_text_view_processor_startup(void);
+extern void dali_text_view_processor_cleanup(void);
+extern void dali_text_view_relayout_utils_startup(void);
+extern void dali_text_view_relayout_utils_cleanup(void);
+extern void dali_text_view_startup(void);
+extern void dali_text_view_cleanup(void);
+
+extern int UtcDaliPushButtonInterruptEventWhenInsensitive(void);
+extern int UtcDaliPushButtonInterruptEventWhenNonVisible(void);
+extern int UtcDaliPushButtonProperties(void);
+extern int UtcDaliTextViewGetIndicesFromGlobalCharacterIndex(void);
+extern int UtcDaliTextViewDebugCouts(void);
+extern int UtcDaliTextViewDefaultConstructorDestructor_PT(void);
+extern int UtcDaliTextViewCopyConstructorOperator(void);
+extern int UtcDaliTextViewEqualityOperator(void);
+extern int UtcDaliTextViewSplitInLines(void);
+extern int UtcDaliTextViewSplitInWords(void);
+extern int UtcDaliTextViewBeginsRightToLeftCharacter(void);
+extern int UtcDaliTextViewContainsRightToLeftCharacter(void);
+extern int UtcDaliTextViewFindNearestWord(void);
+extern int UtcDaliTextViewDefaultConstructorDestructor_RU(void);
+extern int UtcDaliTextViewCalculateSubLineLayout(void);
+extern int UtcDaliTextViewCalculateAlignmentOffsets(void);
+extern int UtcDaliTextViewCalculateJustificationOffsets(void);
+extern int UtcDaliTextViewCalculateVisibility(void);
+extern int UtcDaliTextViewMiscelaneousAsserts(void);
+extern int UtcDaliTextViewCreateTextInfo(void);
+extern int UtcDaliTextViewSplitWord(void);
+extern int UtcDaliTextViewUpdateTextInfo(void);
+extern int UtcDaliTextViewSplitWordGroup(void);
+extern int UtcDaliTextViewSplitLine(void);
+extern int UtcDaliTextViewMergeWord01(void);
+extern int UtcDaliTextViewMergeWord02(void);
+extern int UtcDaliTextViewMergeGroup01(void);
+extern int UtcDaliTextViewMergeGroup02(void);
+extern int UtcDaliTextViewMergeLine01(void);
+extern int UtcDaliTextViewMergeLine02(void);
+extern int UtcDaliTextViewRemoveCharactersFromWord(void);
+extern int UtcDaliTextViewRemoveWordsFromGroup(void);
+extern int UtcDaliTextViewRemoveGroupsFromLine(void);
+
+testcase tc_array[] = {
+ {"UtcDaliPushButtonInterruptEventWhenInsensitive", UtcDaliPushButtonInterruptEventWhenInsensitive, NULL, NULL},
+ {"UtcDaliPushButtonInterruptEventWhenNonVisible", UtcDaliPushButtonInterruptEventWhenNonVisible, NULL, NULL},
+ {"UtcDaliPushButtonProperties", UtcDaliPushButtonProperties, NULL, NULL},
+ {"UtcDaliTextViewGetIndicesFromGlobalCharacterIndex", UtcDaliTextViewGetIndicesFromGlobalCharacterIndex, dali_text_view_helper_and_debug_startup, dali_text_view_helper_and_debug_cleanup},
+ {"UtcDaliTextViewDebugCouts", UtcDaliTextViewDebugCouts, dali_text_view_helper_and_debug_startup, dali_text_view_helper_and_debug_cleanup},
+ {"UtcDaliTextViewDefaultConstructorDestructor_PT", UtcDaliTextViewDefaultConstructorDestructor_PT, dali_text_view_processor_types_startup, dali_text_view_processor_types_cleanup},
+ {"UtcDaliTextViewCopyConstructorOperator", UtcDaliTextViewCopyConstructorOperator, dali_text_view_processor_types_startup, dali_text_view_processor_types_cleanup},
+ {"UtcDaliTextViewEqualityOperator", UtcDaliTextViewEqualityOperator, dali_text_view_processor_types_startup, dali_text_view_processor_types_cleanup},
+ {"UtcDaliTextViewSplitInLines", UtcDaliTextViewSplitInLines, dali_text_view_processor_startup, dali_text_view_processor_cleanup},
+ {"UtcDaliTextViewSplitInWords", UtcDaliTextViewSplitInWords, dali_text_view_processor_startup, dali_text_view_processor_cleanup},
+ {"UtcDaliTextViewBeginsRightToLeftCharacter", UtcDaliTextViewBeginsRightToLeftCharacter, dali_text_view_processor_startup, dali_text_view_processor_cleanup},
+ {"UtcDaliTextViewContainsRightToLeftCharacter", UtcDaliTextViewContainsRightToLeftCharacter, dali_text_view_processor_startup, dali_text_view_processor_cleanup},
+ {"UtcDaliTextViewFindNearestWord", UtcDaliTextViewFindNearestWord, dali_text_view_processor_startup, dali_text_view_processor_cleanup},
+ {"UtcDaliTextViewDefaultConstructorDestructor_RU", UtcDaliTextViewDefaultConstructorDestructor_RU, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup},
+ {"UtcDaliTextViewCalculateSubLineLayout", UtcDaliTextViewCalculateSubLineLayout, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup},
+ {"UtcDaliTextViewCalculateAlignmentOffsets", UtcDaliTextViewCalculateAlignmentOffsets, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup},
+ {"UtcDaliTextViewCalculateJustificationOffsets", UtcDaliTextViewCalculateJustificationOffsets, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup},
+ {"UtcDaliTextViewCalculateVisibility", UtcDaliTextViewCalculateVisibility, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup},
+ {"UtcDaliTextViewMiscelaneousAsserts", UtcDaliTextViewMiscelaneousAsserts, dali_text_view_relayout_utils_startup, dali_text_view_relayout_utils_cleanup},
+ {"UtcDaliTextViewCreateTextInfo", UtcDaliTextViewCreateTextInfo, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewSplitWord", UtcDaliTextViewSplitWord, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewUpdateTextInfo", UtcDaliTextViewUpdateTextInfo, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewSplitWordGroup", UtcDaliTextViewSplitWordGroup, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewSplitLine", UtcDaliTextViewSplitLine, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewMergeWord01", UtcDaliTextViewMergeWord01, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewMergeWord02", UtcDaliTextViewMergeWord02, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewMergeGroup01", UtcDaliTextViewMergeGroup01, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewMergeGroup02", UtcDaliTextViewMergeGroup02, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewMergeLine01", UtcDaliTextViewMergeLine01, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewMergeLine02", UtcDaliTextViewMergeLine02, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewRemoveCharactersFromWord", UtcDaliTextViewRemoveCharactersFromWord, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewRemoveWordsFromGroup", UtcDaliTextViewRemoveWordsFromGroup, dali_text_view_startup, dali_text_view_cleanup},
+ {"UtcDaliTextViewRemoveGroupsFromLine", UtcDaliTextViewRemoveGroupsFromLine, dali_text_view_startup, dali_text_view_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_DALI_TOOLKIT_INTERNAL_CORE_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/internal/controls/buttons/button-impl.h>
+
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+
+static bool gPushButtonToggleState = false;
+bool PushButtonToggled( Button button, bool toggled )
+{
+ gPushButtonToggleState = toggled && ( toggled == static_cast<PushButton&>( button ).IsToggled() );
+ return true;
+}
+
+
+const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 );
+const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 );
+const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 );
+const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 );
+const Dali::TouchPoint pointMotionOut( 0, TouchPoint::Motion, 10, 10 );
+const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 );
+const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 );
+} // namespace
+
+
+//////////////////////////////////////////////////////////
+
+namespace
+{
+static bool gOnTouchPointInterrupted = false;
+} //namespace
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+class TETButton;
+}
+
+/**
+ * Creates a Button to test if interrupt events are handled correctly.
+ */
+class TETButton : public Button
+{
+public:
+ // PushButton Pressed
+ typedef SignalV2< bool ( Button ) > PressedSignalV2;
+
+ PressedSignalV2& PressedSignal();
+
+ /**
+ * Default constructor.
+ */
+ TETButton();
+
+ /**
+ * Copy constructor.
+ */
+ TETButton( const Button& button );
+
+ /**
+ * Assignment operator.
+ */
+ TETButton& operator=( const TETButton& button );
+
+ /**
+ * Creates and initializes a new button.
+ */
+ static TETButton New();
+
+ /**
+ * Down cast to TETButton.
+ */
+ static TETButton DownCast( BaseHandle handle );
+
+ /**
+ * Creates a handle using the Toolkit::Internal implementation.
+ * @param[in] implementation The Control implementation.
+ */
+ TETButton( Internal::TETButton& implementation );
+
+ /**
+ * Allows the creation of this Control from an Internal::CustomActor pointer.
+ * @param[in] internal A pointer to the internal CustomActor.
+ */
+ TETButton( Dali::Internal::CustomActor* internal );
+};
+
+namespace Internal
+{
+
+/**
+ * Internal implementation
+ */
+class TETButton : public Button
+{
+public:
+ /**
+ * Construct a new Button.
+ */
+ TETButton();
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~TETButton();
+
+ /**
+ * Creates an internal button.
+ */
+ static Toolkit::TETButton New();
+
+ /**
+ * @return the pressed signal.
+ */
+ Toolkit::TETButton::PressedSignalV2& PressedSignal();
+
+ /**
+ * Callback called when an interrupt events is received.
+ */
+ void OnTouchPointInterrupted();
+
+ /**
+ * Callback received when a down event is received.
+ */
+ void OnButtonDown();
+
+ Toolkit::TETButton::PressedSignalV2 mPressedSignal; ///< Signal emitted when the button is pressed.
+};
+
+} // namespace Internal
+
+TETButton::TETButton()
+{
+}
+
+TETButton::TETButton( const Button& button )
+: Button( button )
+{
+}
+
+TETButton& TETButton::operator=( const TETButton& button )
+{
+ if( &button != this )
+ {
+ Button::operator=( button );
+ }
+ return *this;
+}
+
+TETButton TETButton::New()
+{
+ return Internal::TETButton::New();
+}
+
+TETButton TETButton::DownCast( BaseHandle handle )
+{
+ return Control::DownCast<TETButton, Internal::TETButton>(handle);
+}
+
+TETButton::PressedSignalV2& TETButton::PressedSignal()
+{
+ TETButton button( *this );
+ DALI_ASSERT_ALWAYS( button );
+
+ Dali::RefObject& handle = button.GetImplementation();
+
+ return static_cast<Toolkit::Internal::TETButton&>( handle ).PressedSignal();
+}
+
+TETButton::TETButton( Internal::TETButton& implementation )
+: Button( implementation )
+{}
+
+TETButton::TETButton( Dali::Internal::CustomActor* internal )
+: Button( internal )
+{
+ VerifyCustomActorPointer<Internal::TETButton>(internal);
+}
+
+namespace Internal
+{
+
+TETButton::TETButton()
+: Button(),
+ mPressedSignal()
+{
+}
+
+TETButton::~TETButton()
+{
+}
+
+Toolkit::TETButton TETButton::New()
+{
+ // Create the implementation, temporarily owned on stack
+ IntrusivePtr< TETButton > internalTETButton = new TETButton();
+
+ // Pass ownership to CustomActor
+ Dali::Toolkit::TETButton tetButton( *internalTETButton );
+
+ // Second-phase init of the implementation
+ // This can only be done after the CustomActor connection has been made...
+ internalTETButton->Initialize();
+
+ return tetButton;
+}
+
+Toolkit::TETButton::PressedSignalV2& TETButton::PressedSignal()
+{
+ return mPressedSignal;
+}
+
+void TETButton::OnButtonDown()
+{
+ Toolkit::TETButton handle( GetOwner() );
+
+ //Emit signal.
+ mPressedSignal.Emit( handle );
+}
+
+void TETButton::OnTouchPointInterrupted()
+{
+ gOnTouchPointInterrupted = true;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+namespace
+{
+
+class TETButtonPressed : public Dali::ConnectionTracker
+{
+public:
+ enum Test
+ {
+ SENSITIVENESS,
+ VISIBILITY
+ };
+
+ TETButtonPressed( Actor actor, Test test )
+ : mActor( actor ),
+ mTest( test )
+ {
+ }
+
+ bool Callback( Button button )
+ {
+ switch( mTest )
+ {
+ case SENSITIVENESS:
+ {
+ mActor.SetSensitive( false );
+ break;
+ }
+ case VISIBILITY:
+ {
+ std::cout <<"VISIBILITY false" << std::endl;
+ mActor.SetVisible( false );
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ return true;
+ }
+
+ Actor mActor;
+ Test mTest;
+};
+
+static bool TestCallback(Actor actor, const TouchEvent& event)
+{
+ return true;
+}
+
+} // namespace
+
+//////////////////////////////////////////////////////////
+
+
+int UtcDaliPushButtonInterruptEventWhenInsensitive(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonInterruptEventWhenInsensitive");
+
+ // * Creates an actor which contains a button.
+ // * The size of the actor is bigger than the button.
+ // * The button's boundary is contained in the actor's one.
+ Actor actor = Actor::New();
+ TETButton tetButton= Toolkit::TETButton::New();
+
+ actor.SetName( "Actor" );
+ tetButton.SetName( "TETButton" );
+
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetPosition( 0, 0 );
+ actor.SetSize( 400, 800 );
+
+ tetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ tetButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ tetButton.SetPosition( 240, 400 );
+ tetButton.SetSize( 100, 100 );
+
+ actor.Add( tetButton );
+ Stage::GetCurrent().Add( actor );
+
+ // * Actor's touch event is connected to a callback function
+ // and this callback function consumes the event.
+ actor.TouchedSignal().Connect( &TestCallback );
+
+ // * Button's pressed signal is connected to a callback function
+ // which also consumes the event.
+ // * Changes the sensitiveness of the button to false.
+ TETButtonPressed tetButtonPressed( actor, TETButtonPressed::SENSITIVENESS );
+ tetButton.PressedSignal().Connect( &tetButtonPressed, &TETButtonPressed::Callback );
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ tetButton.SetSensitive( true );
+
+ Dali::Integration::TouchEvent event;
+
+ // TET starts.
+
+ // Test a down point inside the button which is also consumed by the actor, and an up point
+ // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an
+ // interrupt event.
+
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ // An up event is sent outside the button's boundary but inside the actor's one.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gOnTouchPointInterrupted );
+
+ // Test a down point inside the button which is also consumed by the actor, and a motion point
+ // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an
+ // interrupt event.
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ actor.SetSensitive( true );
+ tetButton.SetSensitive( true );
+
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ // A motion event is sent outside the button's boundary but inside the actor's one.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointMotionOut );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gOnTouchPointInterrupted );
+
+ // Test a down point inside the button which is also consumed by the actor, and an up point
+ // also inside the button and consumed by the actor. gOnTouchPointInterrupted should be false.
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ actor.SetSensitive( true );
+ tetButton.SetSensitive( true );
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ actor.SetSensitive( true );
+ // An up event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gOnTouchPointInterrupted );
+ END_TEST;
+}
+
+int UtcDaliPushButtonInterruptEventWhenNonVisible(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonInterruptEventWhenNonVisible");
+
+ // Does same test as above but changing the visibility instead the sensitiveness.
+
+ // * Creates an actor which contains a button.
+ // * The size of the actor is bigger than the button.
+ // * The button's boundary is contained in the actor's one.
+ Actor actor = Actor::New();
+ TETButton tetButton = Toolkit::TETButton::New();
+
+ actor.SetName( "Actor" );
+ tetButton.SetName( "TETButton" );
+
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetPosition( 0, 0 );
+ actor.SetSize( 400, 800 );
+
+ tetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ tetButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ tetButton.SetPosition( 240, 400 );
+ tetButton.SetSize( 100, 100 );
+
+ actor.Add( tetButton );
+ Stage::GetCurrent().Add( actor );
+
+ // * Actor's touch event is connected to a callback function
+ // and this callback function consumes the event.
+ actor.TouchedSignal().Connect( &TestCallback );
+
+ // * Button's pressed signal is connected to a callback function
+ // which also consumes the event.
+ // * Changes the visibility of the button to false.
+ TETButtonPressed tetButtonPressed( tetButton, TETButtonPressed::VISIBILITY );
+ tetButton.PressedSignal().Connect( &tetButtonPressed, &TETButtonPressed::Callback );
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ tetButton.SetVisible( true );
+
+ Dali::Integration::TouchEvent event;
+
+ // TET starts.
+
+ // Test a down point inside the button which is also consumed by the actor, and an up point
+ // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an
+ // interrupt event.
+
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ // More renders are needed in order to allow the node of the actor to become invisible.
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // An up event is sent outside the button's boundary but inside the actor's one.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gOnTouchPointInterrupted );
+
+ // Test a down point inside the button which is also consumed by the actor, and a motion point
+ // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an
+ // interrupt event.
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ tetButton.SetVisible( true );
+
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ // More renders are needed in order to allow the node of the actor to become invisible.
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // A motion event is sent outside the button's boundary but inside the actor's one.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointMotionOut );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gOnTouchPointInterrupted );
+
+ // Test a down point inside the button which is also consumed by the actor, and an up point
+ // also inside the button and consumed by the actor. gOnTouchPointInterrupted should be false.
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ tetButton.SetVisible( true );
+
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ tetButton.SetVisible( true );
+
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // An up event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gOnTouchPointInterrupted );
+ END_TEST;
+}
+
+int UtcDaliPushButtonProperties(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ // PushButton::PROPERTY_AUTO_REPEATING
+ button.SetAutoRepeating( false );
+ DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_AUTO_REPEATING ) );
+ button.SetProperty( PushButton::PROPERTY_AUTO_REPEATING, true );
+ DALI_TEST_CHECK( button.IsAutoRepeating() ) ;
+ DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_AUTO_REPEATING ) );
+
+ // PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY
+ button.SetInitialAutoRepeatingDelay( 10.0f );
+ DALI_TEST_EQUALS( 10.0f, button.GetProperty< float >( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY ), TEST_LOCATION );
+ button.SetProperty( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY, 25.0f );
+ DALI_TEST_EQUALS( 25.0f, button.GetInitialAutoRepeatingDelay(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 25.0f, button.GetProperty< float >( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY ), TEST_LOCATION );
+
+ // PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY
+ button.SetNextAutoRepeatingDelay( 3.0f );
+ DALI_TEST_EQUALS( 3.0f, button.GetProperty< float >( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY ), TEST_LOCATION );
+ button.SetProperty( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY, 4.0f );
+ DALI_TEST_EQUALS( 4.0f, button.GetNextAutoRepeatingDelay(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 4.0f, button.GetProperty< float >( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY ), TEST_LOCATION );
+
+ // PushButton::PROPERTY_TOGGLABLE
+ button.SetToggleButton( false );
+ DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_TOGGLABLE ) );
+ button.SetProperty( PushButton::PROPERTY_TOGGLABLE, true );
+ DALI_TEST_CHECK( button.IsToggleButton() ) ;
+ DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_TOGGLABLE ) );
+
+ // PushButton::PROPERTY_TOGGLE
+ button.SetToggled( false );
+ DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_TOGGLE ) );
+ button.SetProperty( PushButton::PROPERTY_TOGGLE, true );
+ DALI_TEST_CHECK( button.IsToggled() ) ;
+ DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_TOGGLE ) );
+
+ // PushButton::PROPERTY_NORMAL_STATE_ACTOR
+ {
+ button.SetButtonImage( Image::New( "IMAGE_PATH_1") );
+ DALI_TEST_EQUALS( "IMAGE_PATH_1", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
+
+ Property::Map map;
+ map.push_back( Property::StringValuePair( "type", "ImageActor" ) );
+
+ button.SetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR, map );
+ DALI_TEST_EQUALS( "ImageActor", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+ }
+
+ // PushButton::PROPERTY_PRESSED_IMAGE
+ {
+ button.SetPressedImage( Image::New( "IMAGE_PATH_2") );
+ DALI_TEST_EQUALS( "IMAGE_PATH_2", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
+
+ Property::Map map;
+ map.push_back( Property::StringValuePair( "type", "TextActor" ) );
+
+ button.SetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR, map );
+ DALI_TEST_EQUALS( "TextActor", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+ }
+
+ // PushButton::PROPERTY_DIMMED_STATE_ACTOR
+ {
+ button.SetDimmedImage( Image::New( "IMAGE_PATH_3") );
+ DALI_TEST_EQUALS( "IMAGE_PATH_3", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
+
+ Property::Map map;
+ map.push_back( Property::StringValuePair( "type", "Actor" ) );
+
+ button.SetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR, map );
+ DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+ }
+
+ // PushButton::PROPERTY_LABEL_ACTOR
+ {
+ button.SetLabelText( "LABEL_TEXT_CUSTOM" );
+ DALI_TEST_EQUALS( "TextView", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+
+ Property::Map map;
+ map.push_back( Property::StringValuePair( "type", "Actor" ) );
+
+ button.SetProperty( PushButton::PROPERTY_LABEL_ACTOR, map );
+ DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+ }
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-impl.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+void dali_text_view_helper_and_debug_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_text_view_helper_and_debug_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+// Data structures used to create an 'experiment' in TET cases
+
+const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS;
+const Toolkit::Internal::TextView::VisualParameters DEFAULT_VISUAL_PARAMETERS;
+
+struct GetIndicesFromGlobalCharacterIndexTest
+{
+ std::string description;
+ std::string input;
+ std::size_t position;
+ std::size_t lineIndex;
+ std::size_t groupIndex;
+ std::size_t wordIndex;
+ std::size_t characterIndex;
+};
+
+/**
+ * Gets the line, group, word, and character indices for a given text and a given position and checks the results with the given indices.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment.
+ * @param input The input text.
+ * @param position Global position of the character. i.e in a text with with 1000 characters, position could be any value from 0 to 1000.
+ * @param resultLineIndex Index to the line where the character is located.
+ * @param resultGroupIndex Index to the group within the line where the character is located.
+ * @param resultWordIndex Index to the word within the group where the character is located.
+ * @param resultCharacterIndex Index to the character within the word where the character is located.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestGetIndicesFromGlobalCharacterIndex( const std::string& description,
+ const std::string& input,
+ const std::size_t position,
+ const std::size_t resultLineIndex,
+ const std::size_t resultGroupIndex,
+ const std::size_t resultWordIndex,
+ const std::size_t resultCharacterIndex,
+ const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create natural size, layout and text-actor info for the input word.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ TextViewProcessor::TextInfoIndices indices;
+ TextViewProcessor::GetIndicesFromGlobalCharacterIndex( position,
+ inputLayout,
+ indices );
+
+ if( indices.mLineIndex != resultLineIndex )
+ {
+ tet_printf( "Fail. different line index. %s", location );
+ return false;
+ }
+ if( indices.mGroupIndex != resultGroupIndex )
+ {
+ tet_printf( "Fail. different group index. %s", location );
+ return false;
+ }
+ if( indices.mWordIndex != resultWordIndex )
+ {
+ tet_printf( "Fail. different word index. %s", location );
+ return false;
+ }
+ if( indices.mCharacterIndex != resultCharacterIndex )
+ {
+ tet_printf( "Fail. different character index. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+} // namespace
+
+
+int UtcDaliTextViewGetIndicesFromGlobalCharacterIndex(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewGetIndicesFromGlobalCharacterIndex : ");
+ struct GetIndicesFromGlobalCharacterIndexTest getIndicesFromGlobalCharacterIndexTests[] =
+ {
+ {
+ std::string( "Test position 0" ),
+ std::string( "text te<font size='30'>xt text te</font>xt text\n"
+ "text t<font size='30'>ext טקסט טקסט te</font>xt\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( "t<font size='30'>ext text te</font>xt text text\n"
+ "text text טקסט טקסט text\n"
+ "text text te<font size='30'>xt text</font> text\n"
+ "\n" ),
+ 76,
+ 4,
+ 0,
+ 0,
+ 0
+ },
+ {
+ std::string( "Test position 73. (the last \\n)" ),
+ std::string( "text te<font size='30'>xt text text </font>text\n"
+ "text text טק<font size='30'>סט טקס</font>ט 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 te<font size='30'>xt text text text\n</font>"
+ "text text טק<font size='30'>סט טקסט </font>text\n"
+ "text te<font size='30'>xt text text</font> 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 te<font size='30'>xt text text text\n</font>"
+ "text text טק<font size='30'>סט טקסט </font>text\n"
+ "text te<font size='30'>xt text text</font> text\n"
+ "\n" ),
+ 33,
+ 1,
+ 0,
+ 2,
+ 3
+ },
+ {
+ std::string( "Test position 43. (last hebrew character)" ),
+ std::string( "text te<font size='30'>xt text text text\n</font>"
+ "text text טק<font size='30'>סט טקסט </font>text\n"
+ "text te<font size='30'>xt text text</font> text\n"
+ "\n" ),
+ 43,
+ 1,
+ 1,
+ 3,
+ 3
+ },
+ */
+ };
+ const std::size_t numberOfTests( 5 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const GetIndicesFromGlobalCharacterIndexTest& test = getIndicesFromGlobalCharacterIndexTests[index];
+
+ if( !TestGetIndicesFromGlobalCharacterIndex( test.description, test.input, test.position, test.lineIndex, test.groupIndex, test.wordIndex, test.characterIndex, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewDebugCouts(void)
+{
+ /////////////////////////////////////////////////////
+ // Text debug functions to not to penalize coverage
+ /////////////////////////////////////////////////////
+
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewDebugCouts : ");
+
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( std::string( "Hello world\nhello world" ), inputStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ Actor dummy = Actor::New();
+ Toolkit::Internal::SplitByNewLineChar::Relayout( dummy,
+ Toolkit::Internal::TextView::RELAYOUT_ALL,
+ DEFAULT_LAYOUT_PARAMETERS,
+ DEFAULT_VISUAL_PARAMETERS,
+ relayoutData );
+
+ TextViewProcessor::dbgPrint( relayoutData.mTextLayoutInfo );
+
+ TextStyle textStyle;
+ TextViewProcessor::dbgPrint( textStyle );
+
+ TextViewProcessor::TextInfoIndices indices;
+ TextViewProcessor::dbgPrint( indices );
+
+ TextViewProcessor::dbgPrint( inputStyledText );
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-types.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+void dali_text_view_processor_types_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_text_view_processor_types_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+// Data structures used to create an 'experiment' in TET cases
+
+//////////////////////////////////////////////////////////////////
+} // namespace
+
+
+int UtcDaliTextViewDefaultConstructorDestructor_PT(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewDefaultConstructorDestructor : ");
+
+ TextViewProcessor::TextInfoIndices indices;
+ DALI_TEST_EQUALS( indices.mLineIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.mGroupIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.mWordIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.mCharacterIndex, 0u, TEST_LOCATION );
+
+ TextViewProcessor::CharacterLayoutInfo characterLayoutInfo;
+ DALI_TEST_EQUALS( characterLayoutInfo.mHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mAdvance, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mBearing, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mPosition, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mOffset, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mUnderlineThickness, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mUnderlinePosition, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( !characterLayoutInfo.mGlyphActor );
+ DALI_TEST_CHECK( characterLayoutInfo.mStyledText.mText.IsEmpty() );
+ DALI_TEST_EQUALS( characterLayoutInfo.mColorAlpha, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mGradientColor, Vector4::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mStartPoint, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mEndPoint, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( characterLayoutInfo.mIsVisible );
+ DALI_TEST_CHECK( characterLayoutInfo.mSetText );
+ DALI_TEST_CHECK( characterLayoutInfo.mSetStyle );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo;
+ DALI_TEST_EQUALS( wordLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo.mType, TextViewProcessor::NoSeparator, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo.mCharactersLayoutInfo.size(), 0u, TEST_LOCATION );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo;
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::LTR, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mWordsLayoutInfo.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION );
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo;
+ DALI_TEST_EQUALS( lineLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mLineHeightOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mWordGroupsLayoutInfo.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION );
+
+ TextViewProcessor::TextLayoutInfo textLayoutInfo;
+ DALI_TEST_EQUALS( textLayoutInfo.mWholeTextSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mMaxWordWidth, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mLinesLayoutInfo.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mMaxItalicsOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mType, TextViewProcessor::NoSeparator, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mCharactersLayoutInfo.size(), 0u, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewCopyConstructorOperator(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCopyConstructorOperator : ");
+
+ TextViewProcessor::CharacterLayoutInfo characterLayoutInfo;
+ characterLayoutInfo.mHeight = 1.f;
+ characterLayoutInfo.mAdvance = 1.f;
+ characterLayoutInfo.mBearing = 1.f;
+ characterLayoutInfo.mPosition = Vector3( 1.f, 1.f, 1.f );
+ characterLayoutInfo.mOffset = Vector2( 1.f, 1.f );
+ characterLayoutInfo.mSize = Vector2( 1.f, 1.f );
+ characterLayoutInfo.mAscender = 1.f;
+ characterLayoutInfo.mUnderlineThickness = 1.f;
+ characterLayoutInfo.mUnderlinePosition = 1.f;
+
+ characterLayoutInfo.mGlyphActor = TextActor::New( "Hello" );
+ characterLayoutInfo.mStyledText.mText = Text( "Hello" );
+
+ characterLayoutInfo.mColorAlpha = 0.f;
+ characterLayoutInfo.mGradientColor = Vector4( 1.f, 1.f, 1.f, 1.f );
+ characterLayoutInfo.mStartPoint = Vector2( 1.f, 1.f );
+ characterLayoutInfo.mEndPoint = Vector2( 1.f, 1.f );
+ characterLayoutInfo.mIsVisible = false;
+ characterLayoutInfo.mSetText = false;
+ characterLayoutInfo.mSetStyle = false;
+
+ TextViewProcessor::CharacterLayoutInfo characterLayoutInfo1;
+ characterLayoutInfo1 = characterLayoutInfo;
+
+ DALI_TEST_EQUALS( characterLayoutInfo1.mHeight, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mAdvance, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mBearing, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mPosition, Vector3( 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mOffset, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mUnderlineThickness, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mUnderlinePosition, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( characterLayoutInfo1.mGlyphActor );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mStyledText.mText.GetLength(), 5u, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mColorAlpha, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mGradientColor, Vector4( 1.f, 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mStartPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mEndPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( !characterLayoutInfo1.mIsVisible );
+ DALI_TEST_CHECK( !characterLayoutInfo1.mSetText );
+ DALI_TEST_CHECK( !characterLayoutInfo1.mSetStyle );
+
+ TextViewProcessor::CharacterLayoutInfo characterLayoutInfo2( characterLayoutInfo );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mHeight, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mAdvance, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mBearing, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mPosition, Vector3( 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mOffset, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mUnderlineThickness, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mUnderlinePosition, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( characterLayoutInfo2.mGlyphActor );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mStyledText.mText.GetLength(), 5u, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mColorAlpha, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mGradientColor, Vector4( 1.f, 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mStartPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mEndPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( !characterLayoutInfo2.mIsVisible );
+ DALI_TEST_CHECK( !characterLayoutInfo2.mSetText );
+ DALI_TEST_CHECK( !characterLayoutInfo2.mSetStyle );
+
+ // Increases coverage.
+ characterLayoutInfo2.mGlyphActor.Reset();
+ characterLayoutInfo1 = characterLayoutInfo2;
+ DALI_TEST_CHECK( !characterLayoutInfo1.mGlyphActor );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo;
+ wordLayoutInfo.mSize = Vector2( 1.f, 1.f );
+ wordLayoutInfo.mAscender = 1.f;
+ wordLayoutInfo.mType = TextViewProcessor::LineSeparator;
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo1;
+ wordLayoutInfo1 = wordLayoutInfo;
+
+ DALI_TEST_EQUALS( wordLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo1.mType, TextViewProcessor::LineSeparator, TEST_LOCATION );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo2( wordLayoutInfo );
+
+ DALI_TEST_EQUALS( wordLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo2.mType, TextViewProcessor::LineSeparator, TEST_LOCATION );
+
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo;
+ wordGroupLayoutInfo.mSize = Vector2( 1.f, 1.f );
+ wordGroupLayoutInfo.mAscender = 1.f;
+ wordGroupLayoutInfo.mDirection = TextViewProcessor::RTL;
+ wordGroupLayoutInfo.mNumberOfCharacters = 1u;
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo1;
+ wordGroupLayoutInfo1 = wordGroupLayoutInfo;
+
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::RTL, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 1u, TEST_LOCATION );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo2( wordGroupLayoutInfo );
+
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::RTL, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 1u, TEST_LOCATION );
+
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo;
+ lineLayoutInfo.mSize = Vector2( 1.f, 1.f );
+ lineLayoutInfo.mAscender = 1.f;
+ lineLayoutInfo.mLineHeightOffset = 1.f;
+ lineLayoutInfo.mNumberOfCharacters = 1u;
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo1;
+ lineLayoutInfo1 = lineLayoutInfo;
+
+ DALI_TEST_EQUALS( lineLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo1.mLineHeightOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo1.mNumberOfCharacters, 1u, TEST_LOCATION );
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo2( lineLayoutInfo );
+
+ DALI_TEST_EQUALS( lineLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo2.mLineHeightOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo2.mNumberOfCharacters, 1u, TEST_LOCATION );
+
+ TextViewProcessor::TextLayoutInfo textLayoutInfo;
+ textLayoutInfo.mWholeTextSize = Vector2( 1.f, 1.f );
+ textLayoutInfo.mMaxWordWidth = 1.f;
+ textLayoutInfo.mNumberOfCharacters = 1u;
+ textLayoutInfo.mMaxItalicsOffset = 1.f;
+
+ TextViewProcessor::TextLayoutInfo textLayoutInfo1;
+ textLayoutInfo1 = textLayoutInfo;
+
+ DALI_TEST_EQUALS( textLayoutInfo1.mWholeTextSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo1.mMaxWordWidth, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo1.mNumberOfCharacters, 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo1.mMaxItalicsOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ TextViewProcessor::TextLayoutInfo textLayoutInfo2( textLayoutInfo );
+
+ DALI_TEST_EQUALS( textLayoutInfo2.mWholeTextSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mMaxWordWidth, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mNumberOfCharacters, 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mMaxItalicsOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewEqualityOperator(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewEqualityOperator : ");
+
+ TextViewProcessor::TextInfoIndices indices;
+ TextViewProcessor::TextInfoIndices indices1( 1u, 1u, 1u, 1u );
+
+ DALI_TEST_CHECK( !( indices == indices1 ) );
+
+ indices = indices1;
+
+ DALI_TEST_CHECK( indices == indices1 );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/text-processor.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+void dali_text_view_processor_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_text_view_processor_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+// Data structures used to create an 'experiment' in TET cases
+
+//////////////////////////////////////////////////////////////////
+
+struct BeginsRightToLeftCharacterTest
+{
+ std::string description;
+ std::string input;
+ bool result;
+};
+
+bool TestBeginsRightToLeftCharacter( const std::string& description, const std::string& input, const bool result, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( input, styledText, true );
+
+ const bool ret = ( result == TextProcessor::BeginsRightToLeftCharacter( styledText ) );
+
+ if( !ret )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Input : %s", input.c_str() );
+ }
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct ContainsRightToLeftCharacterTest
+{
+ std::string description;
+ std::string input;
+ bool result;
+};
+
+bool TestContainsRightToLeftCharacter( const std::string& description, const std::string& input, const bool result, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( input, styledText, true );
+
+ const bool ret = ( result == TextProcessor::ContainsRightToLeftCharacter( styledText ) );
+
+ if( !ret )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Input : %s", input.c_str() );
+ }
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct FindNearestWordTest
+{
+ std::string description;
+ std::string input;
+ std::size_t offset;
+ std::size_t start;
+ std::size_t end;
+};
+
+bool TestFindNearestWord( const std::string& description, const std::string& input, const std::size_t offset, const std::size_t startResult, const std::size_t endResult, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( input, styledText, true );
+
+ std::size_t start;
+ std::size_t end;
+ TextProcessor::FindNearestWord( styledText, offset, start, end );
+
+ const bool ret = ( start == startResult ) && ( end == endResult );
+
+ if( !ret )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Input : %s, offset %d, start %d, end %d", input.c_str(), offset, start, end );
+ }
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct SplitInLinesTest
+{
+ std::string inputText;
+
+ std::size_t resultNumberOfLines;
+};
+
+bool TestSplitInLines( const SplitInLinesTest& test, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( test.inputText, styledText, true );
+
+ std::vector<MarkupProcessor::StyledTextArray> 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<MarkupProcessor::StyledTextArray> words;
+
+ TextProcessor::SplitInWords( styledText,
+ words );
+
+ if( words.size() != test.resultNumberOfWords )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Different number of words, result %d, expected result %d", words.size(), test.resultNumberOfWords );
+
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+} // namespace
+
+
+int UtcDaliTextViewSplitInLines(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitInLines : ");
+
+ struct SplitInLinesTest splitInLinesTest[] =
+ {
+ {
+ std::string( "Hello world\nhello world." ),
+ 2
+ },
+ {
+ std::string( "Hello world\nhello world.\n\n" ),
+ 4
+ }
+ };
+ const std::size_t numberOfTests( 2 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitInLinesTest& test = splitInLinesTest[index];
+
+ if( !TestSplitInLines( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewSplitInWords(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitInWords : ");
+
+ struct SplitInWordsTest splitInWordsTest[] =
+ {
+ {
+ std::string( "Hello world, hello word!" ),
+ 7
+ },
+ };
+ const std::size_t numberOfTests( 1 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitInWordsTest& test = splitInWordsTest[index];
+
+ if( !TestSplitInWords( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewBeginsRightToLeftCharacter(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewBeginsRightToLeftCharacter : ");
+
+ struct BeginsRightToLeftCharacterTest beginsRightToLeftCharacterTest[] =
+ {
+ {
+ std::string( "Test if it begins with a right to left character. Should return false." ),
+ std::string( "Hello world مرحبا العالم." ),
+ false
+ },
+ {
+ std::string( "Test if it begins with a right to left character. Should return true." ),
+ std::string( "مرحبا العالم Hola mundo." ),
+ true
+ }
+ };
+ const std::size_t numberOfTests( 2 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const BeginsRightToLeftCharacterTest& test = beginsRightToLeftCharacterTest[index];
+
+ if( !TestBeginsRightToLeftCharacter( test.description, test.input, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewContainsRightToLeftCharacter(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewContainsRightToLeftCharacter : ");
+
+ struct ContainsRightToLeftCharacterTest containsRightToLeftCharacterTest[] =
+ {
+ {
+ std::string( "Test if it contains a right to left character. Should return true." ),
+ std::string( "Hello world مرحبا العالم." ),
+ true
+ },
+ {
+ std::string( "Test if it contains a right to left character. Should return true." ),
+ std::string( "مرحبا العالم Hola mundo." ),
+ true
+ },
+ {
+ std::string( "Test if it contains a right to left character. Should return false." ),
+ std::string( "Hello world." ),
+ false
+ },
+ {
+ std::string( "Test if it contains a right to left character. Should return true." ),
+ std::string( "مرحبا العالم." ),
+ true
+ }
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const ContainsRightToLeftCharacterTest& test = containsRightToLeftCharacterTest[index];
+
+ if( !TestContainsRightToLeftCharacter( test.description, test.input, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewFindNearestWord(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewFindNearestWord : ");
+
+ struct FindNearestWordTest findNearestWordTest[] =
+ {
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 0u,
+ 0u,
+ 5u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 7u,
+ 6u,
+ 12u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 11u,
+ 6u,
+ 12u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 23u,
+ 18u,
+ 23u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 5u,
+ 0u,
+ 5u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo مرحبا العالم" ),
+ 24u,
+ 25u,
+ 30u
+ }
+ };
+
+ const std::size_t numberOfTests( 6 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const FindNearestWordTest& test = findNearestWordTest[index];
+
+ if( !TestFindNearestWord( test.description, test.input, test.offset, test.start, test.end, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+void dali_text_view_relayout_utils_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_text_view_relayout_utils_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS;
+
+// Data structures used to create an 'experiment' in TET cases
+
+
+bool TestEqual( float x, float y )
+{
+ return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 );
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct CalculateSubLineLayoutTest
+{
+ std::string description;
+ std::string inputLine;
+ float parentWidth;
+ std::size_t groupIndex;
+ std::size_t wordIndex;
+ std::size_t characterIndex;
+ TextViewRelayout::HorizontalWrapType splitPolicy;
+ float shrinkFactor;
+
+ float resultLineLength;
+ float resultMaxCharHeight;
+ float resultMaxAscender;
+};
+
+bool TestCalculateSubLineLayout( const CalculateSubLineLayoutTest& test, const char* location )
+{
+ tet_printf( "%s", test.description.c_str() );
+
+ // Create styled text.
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( test.inputLine, inputStyledText, true );
+
+ // Create styled text layout info.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ // Prepare input parameters and the result structure and call the function to be tested.
+
+ // Creaqte indices.
+ TextViewProcessor::TextInfoIndices indices( 0, test.groupIndex, test.wordIndex, test.characterIndex );
+
+ // Get the input line.
+ TextViewProcessor::LineLayoutInfo inputLineLayout;
+
+ if( !relayoutData.mTextLayoutInfo.mLinesLayoutInfo.empty() )
+ {
+ inputLineLayout = *relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin();
+ }
+
+ // Result struct.
+ TextViewRelayout::SubLineLayoutInfo resultLayoutInfo;
+
+ CalculateSubLineLayout( test.parentWidth,
+ indices,
+ inputLineLayout,
+ test.splitPolicy,
+ test.shrinkFactor,
+ resultLayoutInfo );
+
+ // Check results.
+ if( !TestEqual( test.resultLineLength, resultLayoutInfo.mLineLength ) )
+ {
+ tet_printf( "Fail. different line length %f == %f. %s", test.resultLineLength, resultLayoutInfo.mLineLength, location );
+ return false;
+ }
+
+ if( !TestEqual( test.resultMaxCharHeight, resultLayoutInfo.mMaxCharHeight ) )
+ {
+ tet_printf( "Fail. different max character height %f == %f. %s", test.resultMaxCharHeight, resultLayoutInfo.mMaxCharHeight, location );
+ return false;
+ }
+
+ if( !TestEqual( test.resultMaxAscender, resultLayoutInfo.mMaxAscender ) )
+ {
+ tet_printf( "Fail. different max ascender %f == %f. %s", test.resultMaxAscender, resultLayoutInfo.mMaxAscender, location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct AlignmentOffsetTest
+{
+ Toolkit::Alignment::Type alignment;
+ float parentSize;
+ float wholeTextSize;
+
+ float resultOffset;
+};
+
+bool TestAlignmentOffset( const AlignmentOffsetTest& test, const char* location )
+{
+ float offset = 0.f;
+
+ switch( test.alignment )
+ {
+ case Toolkit::Alignment::HorizontalLeft:
+ case Toolkit::Alignment::HorizontalCenter:
+ case Toolkit::Alignment::HorizontalRight:
+ {
+ offset = TextViewRelayout::CalculateXoffset( test.alignment, test.parentSize, test.wholeTextSize );
+ break;
+ }
+ case Toolkit::Alignment::VerticalTop:
+ case Toolkit::Alignment::VerticalCenter:
+ case Toolkit::Alignment::VerticalBottom:
+ {
+ offset = TextViewRelayout::CalculateYoffset( test.alignment, test.parentSize, test.wholeTextSize );
+ break;
+ }
+ }
+
+ // Check results.
+ if( !TestEqual( test.resultOffset, offset ) )
+ {
+ tet_printf( "Fail. different offset %f == %f. %s", test.resultOffset, offset, location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct JustificationOffsetTest
+{
+ Toolkit::TextView::LineJustification justification;
+ float wholeTextWidth;
+ float lineLength;
+
+ float resultOffset;
+};
+
+bool TestJustificationOffset( const JustificationOffsetTest& test, const char* location )
+{
+ float offset = TextViewRelayout::CalculateJustificationOffset( test.justification, test.wholeTextWidth, test.lineLength );
+
+ // Check results.
+ if( !TestEqual( test.resultOffset, offset ) )
+ {
+ tet_printf( "Fail. different offset %f == %f. %s", test.resultOffset, offset, location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct CalculateVisibilityTest
+{
+ Vector3 position;
+ Size size;
+ Size parentSize;
+ TextViewRelayout::VisibilityTestType type;
+
+ bool resultVisible;
+};
+
+bool TestCalculateVisibility( const CalculateVisibilityTest& test, const char* location )
+{
+ if( test.resultVisible != TextViewRelayout::IsVisible( test.position, test.size, test.parentSize, test.type ) )
+ {
+ tet_printf( "Fail. different visibility. Type %d, %s", test.type, location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+} // namespace
+
+
+int UtcDaliTextViewDefaultConstructorDestructor_RU(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewDefaultConstructorDestructor : ");
+
+ // Test RelayoutParameters defaults.
+ TextViewRelayout::RelayoutParameters relayoutParameters;
+
+ DALI_TEST_EQUALS( relayoutParameters.mPositionOffset, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mLineSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mWordSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mCharacterSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mLineIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mGroupIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mWordIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mCharacterIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mCharacterGlobalIndex, 0u, TEST_LOCATION );
+ DALI_TEST_CHECK( !relayoutParameters.mIsFirstCharacter );
+ DALI_TEST_CHECK( !relayoutParameters.mIsFirstCharacterOfWord );
+ DALI_TEST_CHECK( !relayoutParameters.mIsNewLine );
+ DALI_TEST_CHECK( !relayoutParameters.mIsNewLineCharacter );
+ DALI_TEST_CHECK( !relayoutParameters.mIsWhiteSpace );
+ DALI_TEST_CHECK( !relayoutParameters.mIsVisible );
+
+ // Test FadeParameter defaults
+ TextViewRelayout::FadeParameters fadeParameters;
+
+ DALI_TEST_EQUALS( fadeParameters.mRightFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mRightFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mRightFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mRightFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mRightAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( !fadeParameters.mIsPartiallyVisible );
+
+ // Test EllipsizeParameters defaults
+ TextViewRelayout::EllipsizeParameters ellipsizeParameters;
+
+ DALI_TEST_EQUALS( ellipsizeParameters.mPosition, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mLineDescender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mLineWidth, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mEllipsizeBoundary, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mFirstIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mLastIndex, 0u, TEST_LOCATION );
+ DALI_TEST_CHECK( !ellipsizeParameters.mEllipsizeLine );
+ DALI_TEST_CHECK( !ellipsizeParameters.mIsLineWidthFullyVisible );
+ DALI_TEST_CHECK( !ellipsizeParameters.mIsLineHeightFullyVisible );
+ DALI_TEST_CHECK( !ellipsizeParameters.mIsNextLineFullyVisibleHeight );
+ DALI_TEST_CHECK( !ellipsizeParameters.mCreateEllipsizedTextActors );
+ DALI_TEST_CHECK( !ellipsizeParameters.mLineFits );
+ DALI_TEST_CHECK( !ellipsizeParameters.mWordFits );
+
+ // Test UnderlineInfo defaults
+ TextViewRelayout::UnderlineInfo underlineInfo;
+
+ DALI_TEST_EQUALS( underlineInfo.mMaxHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( underlineInfo.mMaxThickness, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( underlineInfo.mPosition, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Test TextUnderlineStatus defaults
+ TextViewRelayout::TextUnderlineStatus textUnderlineStatus;
+
+ DALI_TEST_CHECK( textUnderlineStatus.mUnderlineInfo.empty() );
+ DALI_TEST_EQUALS( textUnderlineStatus.mCharacterGlobalIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textUnderlineStatus.mLineGlobalIndex, 0u, TEST_LOCATION );
+ DALI_TEST_CHECK( !textUnderlineStatus.mCurrentUnderlineStatus );
+
+ // Test SubLineLayoutInfo defaults
+ TextViewRelayout::SubLineLayoutInfo subLineLayoutInfo;
+
+ DALI_TEST_EQUALS( subLineLayoutInfo.mLineLength, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( subLineLayoutInfo.mMaxCharHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( subLineLayoutInfo.mMaxAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewCalculateSubLineLayout(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCalculateSubLineLayout : ");
+
+ struct CalculateSubLineLayoutTest calculateSubLineLayoutTest[] =
+ {
+ //WrapByCharacter
+ {
+ "The line is wraped by character. All characters have the same size.",
+ "Hello world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices
+ 0,
+ TextViewRelayout::WrapByCharacter, // split policy
+ 1.f,
+ // results
+ 91.041672f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by character. There are characters with different sizes.",
+ "Hello <font size='14'>world</font>", // 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 <font size='14'>wo</font>rld hell<font size='14'>o world</font>", // 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 <font size='14'>wo</font>rld hell<font size='14'>o world</font>", // 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.",
+ "Hell<font size='14'>o</font> 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 <font size='14'>wo</font>rld <font size='16'>hello world</font>", // 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 <font size='14'>world</font>", // 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<font size='14'> world</font>", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices.
+ 8,
+ TextViewRelayout::WrapByWordAndSplit, // split policy
+ 0.7f,
+ // results
+ 95.593755f, // line length. (only fits 12 characters 8x11.38)
+ 7.9661463f, // max character height
+ 7.169531f // max ascender
+ },
+
+ //WrapByLineAndSplit
+ {
+ "The line is wraped by end of line and by character. All characters have the same size.",
+ "Hello world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices
+ 0,
+ TextViewRelayout::WrapByLineAndSplit, // split policy
+ 1.f,
+ // results
+ 91.041672f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line fits in the width.",
+ "Hello", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices
+ 0,
+ TextViewRelayout::WrapByLineAndSplit, // split policy
+ 1.f,
+ // results
+ 56.901047f, // line length. (only fits 5 characters 5x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by end of line and by character. All characters have the same size. It calculates the layout for the second line.",
+ "Hello world, hello world", // input line
+ 100.f, // parent width
+ 0,
+ 2, // indices
+ 2,
+ TextViewRelayout::WrapByLineAndSplit, // split policy
+ 1.f,
+ // results
+ 91.041672f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ };
+ const std::size_t numberOfTests( 15 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const CalculateSubLineLayoutTest& test = calculateSubLineLayoutTest[index];
+
+ if( !TestCalculateSubLineLayout( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewCalculateAlignmentOffsets(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCalculateAlignmentOffsets : ");
+
+ struct AlignmentOffsetTest alignmentOffsetTest[] =
+ {
+ {
+ Toolkit::Alignment::HorizontalLeft,
+ 100.f,
+ 75.f,
+ 0.f
+ },
+ {
+ Toolkit::Alignment::HorizontalCenter,
+ 100.f,
+ 75.f,
+ 12.5f
+ },
+ {
+ Toolkit::Alignment::HorizontalRight,
+ 100.f,
+ 75.f,
+ 25.f
+ },
+ {
+ Toolkit::Alignment::VerticalTop,
+ 100.f,
+ 75.f,
+ 0.f
+ },
+ {
+ Toolkit::Alignment::VerticalCenter,
+ 100.f,
+ 75.f,
+ 12.5f
+ },
+ {
+ Toolkit::Alignment::VerticalBottom,
+ 100.f,
+ 75.f,
+ 25.f
+ }
+ };
+ const std::size_t numberOfTests( 6 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const AlignmentOffsetTest& test = alignmentOffsetTest[index];
+
+ if( !TestAlignmentOffset( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewCalculateJustificationOffsets(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCalculateJustificationOffsets : ");
+
+ struct JustificationOffsetTest justificationOffsetTest[] =
+ {
+ {
+ Toolkit::TextView::Left,
+ 100.f,
+ 75.f,
+ 0.f
+ },
+ {
+ Toolkit::TextView::Justified,
+ 100.f,
+ 75.f,
+ 0.f
+ },
+ {
+ Toolkit::TextView::Center,
+ 100.f,
+ 150.f,
+ -25.f
+ },
+ {
+ Toolkit::TextView::Right,
+ 100.f,
+ 75.f,
+ 25.f
+ },
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const JustificationOffsetTest& test = justificationOffsetTest[index];
+
+ if( !TestJustificationOffset( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+
+int UtcDaliTextViewCalculateVisibility(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCalculateVisibility : ");
+
+ struct CalculateVisibilityTest calculateVisibilityTest[] =
+ {
+ {
+ Vector3( 0.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE,
+ true
+ },
+ {
+ Vector3( 10.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE,
+ true
+ },
+ {
+ Vector3( 0.f, 10.f, 0.f ),
+ Size( 150.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE,
+ false
+ },
+ {
+ Vector3( 0.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE_WIDTH,
+ true
+ },
+ {
+ Vector3( 95.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE_WIDTH,
+ false
+ },
+ {
+ Vector3( 0.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE_HEIGHT,
+ true
+ },
+ {
+ Vector3( 0.f, 0.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE_HEIGHT,
+ false
+ },
+ {
+ Vector3( -10.f, 10.f, 0.f ),
+ Size( 150.f, 150.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE,
+ true
+ },
+ {
+ Vector3( -100.f, -100.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE,
+ false
+ },
+ {
+ Vector3( -10.f, 10.f, 0.f ),
+ Size( 50.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE_WIDTH,
+ true
+ },
+ {
+ Vector3( 110.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE_WIDTH,
+ false
+ },
+ {
+ Vector3( 0.f, 20.f, 0.f ),
+ Size( 10.f, 50.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE_HEIGHT,
+ true
+ },
+ {
+ Vector3( 0.f, -10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE_HEIGHT,
+ false
+ },
+ };
+ const std::size_t numberOfTests( 13 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const CalculateVisibilityTest& test = calculateVisibilityTest[index];
+
+ if( !TestCalculateVisibility( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewMiscelaneousAsserts(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMiscelaneousAsserts : ");
+
+ float offset = 0.f;
+
+ bool assert1 = false;
+ bool assert2 = false;
+ try
+ {
+ offset = Toolkit::Internal::TextViewRelayout::CalculateXoffset( Toolkit::Alignment::VerticalTop, 100.f, 50.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewRelayout::CalculateXoffset: Wrong horizontal text alignment. Did you set a vertical one?\"", TEST_LOCATION );
+ assert1 = true;
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+ DALI_TEST_EQUALS( offset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ try
+ {
+ offset = Toolkit::Internal::TextViewRelayout::CalculateYoffset( Toolkit::Alignment::HorizontalRight, 100.f, 50.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewRelayout::CalculateXoffset: Wrong vertical text alignment. Did you set an horizontal one?\"", TEST_LOCATION );
+ assert2 = true;
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+ DALI_TEST_EQUALS( offset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ DALI_TEST_CHECK( assert1 && assert2 );
+
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+// Internal headers are allowed here
+#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-line-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
+#include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+void dali_text_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_text_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS;
+const Toolkit::Internal::TextView::VisualParameters DEFAULT_VISUAL_PARAMETERS;
+
+// Data structures used to create an 'experiment' in TET cases
+
+struct SplitWordTest
+{
+ std::string description;
+ std::string input;
+ std::size_t position;
+ std::string firstResult;
+ std::string lastResult;
+};
+
+struct SplitWordGroupTest
+{
+ std::string description;
+ std::string input;
+ std::size_t wordPosition;
+ std::size_t position;
+ std::string firstResult;
+ std::string lastResult;
+};
+
+struct SplitLineTest
+{
+ std::string description;
+ std::string input;
+ std::size_t groupPosition;
+ std::size_t wordPosition;
+ std::size_t position;
+ float lineHeightOffset;
+ std::string firstResult;
+ std::string lastResult;
+};
+
+struct MergeWordsTest
+{
+ std::string description;
+ std::string inputFirst;
+ std::string inputLast;
+ std::string result;
+};
+
+struct MergeWordGroupsTest
+{
+ std::string description;
+ std::string inputFirst;
+ std::string inputLast;
+ std::string result;
+};
+
+struct MergeLinesTest
+{
+ std::string description;
+ std::string inputFirst;
+ std::string inputLast;
+ float lineHeightOffset;
+ std::string result;
+};
+
+struct RemoveCharactersFromWordTest
+{
+ std::string description;
+ std::string input;
+ std::size_t position;
+ std::size_t numberOfCharacters;
+ std::string result;
+};
+
+struct RemoveWordsFromGroupTest
+{
+ std::string description;
+ std::string input;
+ std::size_t wordIndex;
+ std::size_t numberOfWords;
+ std::string result;
+};
+
+struct RemoveGroupsFromLineTest
+{
+ std::string description;
+ std::string input;
+ std::size_t groupIndex;
+ std::size_t numberOfGroups;
+ float lineHeightOffset;
+ std::string result;
+};
+
+enum UpdateTextInfoOperation
+{
+ Insert,
+ Remove,
+ Replace
+};
+
+struct UpdateTextInfoTest
+{
+ std::string description;
+ UpdateTextInfoOperation operation;
+ std::string input;
+ std::size_t position;
+ std::size_t numberOfCharacters;
+ std::string inputText;
+ float lineHeightOffset;
+ std::string result;
+};
+
+// Useful Print functions when something goes wrong.
+
+void Print( const TextViewProcessor::CharacterLayoutInfo& character )
+{
+ std::cout << " height : " << character.mHeight << std::endl;
+ std::cout << " advance : " << character.mAdvance << std::endl;
+ std::cout << " bearing : " << character.mBearing << std::endl;
+ std::cout << " mPosition : " << character.mPosition << std::endl;
+ std::cout << " mSize : " << character.mSize << std::endl;
+ std::cout << " mAscender : " << character.mAscender << std::endl;
+
+ TextActor textActor = TextActor::DownCast( character.mGlyphActor );
+ if( textActor )
+ {
+ std::cout << "[" << textActor.GetText() << "]";
+ }
+ else
+ {
+ std::cout << "{" << character.mStyledText.mText.GetText() << "}";
+ }
+}
+
+void Print( const TextViewProcessor::WordLayoutInfo& word )
+{
+ std::cout << "[";
+ std::cout << " mSize : " << word.mSize << std::endl;
+ std::cout << " mAscender : " << word.mAscender << std::endl;
+ std::cout << " mType : " << word.mType << std::endl;
+ std::cout << "mNumberOfCharacters : " << word.mCharactersLayoutInfo.size() << std::endl;
+ std::cout << "[";
+ for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it = word.mCharactersLayoutInfo.begin(), endIt = word.mCharactersLayoutInfo.end(); it != endIt; ++it )
+ {
+ Print( *it );
+ }
+ std::cout << "]"; std::cout << std::endl;
+ std::cout << "]"; std::cout << std::endl;
+}
+
+void Print( const TextViewProcessor::WordGroupLayoutInfo& wordGroup )
+{
+ std::cout << "(";
+ std::cout << " mSize : " << wordGroup.mSize << std::endl;
+ std::cout << " mAscender : " << wordGroup.mAscender << std::endl;
+ std::cout << " mDirection : " << wordGroup.mDirection << std::endl;
+ std::cout << "mNumberOfCharacters : " << wordGroup.mNumberOfCharacters << std::endl;
+ for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it = wordGroup.mWordsLayoutInfo.begin(), endIt = wordGroup.mWordsLayoutInfo.end(); it != endIt; ++it )
+ {
+ Print( *it );
+ }
+ std::cout << ")"; std::cout << std::endl;
+}
+
+void Print( const TextViewProcessor::LineLayoutInfo& line )
+{
+ std::cout << "<";
+ std::cout << " mSize : " << line.mSize << std::endl;
+ std::cout << " mAscender : " << line.mAscender << std::endl;
+ std::cout << "mNumberOfCharacters : " << line.mNumberOfCharacters << std::endl;
+ for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it = line.mWordGroupsLayoutInfo.begin(), endIt = line.mWordGroupsLayoutInfo.end(); it != endIt; ++it )
+ {
+ Print( *it );
+ }
+ std::cout << ">" << std::endl;
+}
+
+void Print( const TextViewProcessor::TextLayoutInfo& text )
+{
+ std::cout << "||";
+ for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it = text.mLinesLayoutInfo.begin(), endIt = text.mLinesLayoutInfo.end(); it != endIt; ++it )
+ {
+ Print( *it );
+ }
+ std::cout << "||" << std::endl;
+}
+
+void Print( const TextStyle& style )
+{
+ std::cout << " font name : " << style.GetFontName() << std::endl;
+ std::cout << " : " << style.GetFontStyle() << std::endl;
+ std::cout << " : " << style.GetFontPointSize() << std::endl;
+ std::cout << " : " << style.GetWeight() << std::endl;
+ std::cout << " : " << style.GetTextColor() << std::endl;
+ std::cout << " : " << style.GetItalics() << std::endl;
+ std::cout << " : " << style.GetUnderline() << std::endl;
+ std::cout << " : " << style.GetShadow() << std::endl;
+ std::cout << " : " << style.GetShadowColor() << std::endl;
+ std::cout << " : " << style.GetShadowOffset() << std::endl;
+ std::cout << " : " << style.GetGlow() << std::endl;
+ std::cout << " : " << style.GetGlowColor() << std::endl;
+ std::cout << " : " << style.GetGlowIntensity() << std::endl;
+ std::cout << " : " << style.GetSmoothEdge() << std::endl;
+ std::cout << " : " << style.GetOutline() << std::endl;
+ std::cout << " : " << style.GetOutlineThickness() << std::endl;
+}
+
+// Test functions used to check if two data structures are equal.
+
+bool TestEqual( float x, float y )
+{
+ return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 );
+}
+
+bool TestEqual( const TextViewProcessor::CharacterLayoutInfo& character1,
+ const TextViewProcessor::CharacterLayoutInfo& character2 )
+{
+ if( !TestEqual( character1.mHeight, character2.mHeight ) )
+ {
+ return false;
+ }
+ if( !TestEqual( character1.mAdvance, character2.mAdvance ) )
+ {
+ return false;
+ }
+ if( !TestEqual( character1.mBearing, character2.mBearing ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( character1.mPosition.x, character2.mPosition.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( character1.mPosition.y, character2.mPosition.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( character1.mSize.x, character2.mSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( character1.mSize.y, character2.mSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( character1.mAscender, character2.mAscender ) )
+ {
+ return false;
+ }
+
+ if( character1.mGlyphActor && !character2.mGlyphActor )
+ {
+ return false;
+ }
+
+ if( !character1.mGlyphActor && character2.mGlyphActor )
+ {
+ return false;
+ }
+
+ std::string text1;
+ std::string text2;
+ TextStyle style1;
+ TextStyle style2;
+
+ TextActor textActor1 = TextActor::DownCast( character1.mGlyphActor );
+ TextActor textActor2 = TextActor::DownCast( character2.mGlyphActor );
+ if( textActor1 )
+ {
+ text1 = textActor1.GetText();
+ style1 = textActor1.GetTextStyle();
+
+ text2 = textActor2.GetText();
+ style2 = textActor2.GetTextStyle();
+ }
+
+ if( text1 != text2 )
+ {
+ return false;
+ }
+
+ if( style1 != style2 )
+ {
+ return false;
+ }
+
+ text1 = character1.mStyledText.mText.GetText();
+ style1 = character1.mStyledText.mStyle;
+
+ text2 = character2.mStyledText.mText.GetText();
+ style2 = character2.mStyledText.mStyle;
+
+ if( text1 != text2 )
+ {
+ return false;
+ }
+
+ if( style1 != style2 )
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool TestEqual( const TextViewProcessor::WordLayoutInfo& word1,
+ const TextViewProcessor::WordLayoutInfo& word2 )
+{
+ if( !TestEqual( word1.mSize.x, word2.mSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( word1.mSize.y, word2.mSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( word1.mAscender, word2.mAscender ) )
+ {
+ return false;
+ }
+
+ if( word1.mType != word2.mType )
+ {
+ return false;
+ }
+
+ if( word1.mCharactersLayoutInfo.size() != word2.mCharactersLayoutInfo.size() )
+ {
+ return false;
+ }
+
+ for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it1 = word1.mCharactersLayoutInfo.begin(), endIt1 = word1.mCharactersLayoutInfo.end(),
+ it2 = word2.mCharactersLayoutInfo.begin(), endIt2 = word2.mCharactersLayoutInfo.end();
+ ( it1 != endIt1 ) && ( it2 != endIt2 );
+ ++it1, ++it2 )
+ {
+ if( !TestEqual( *it1, *it2 ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TestEqual( const TextViewProcessor::WordGroupLayoutInfo& group1,
+ const TextViewProcessor::WordGroupLayoutInfo& group2 )
+{
+
+ if( group1.mNumberOfCharacters != group2.mNumberOfCharacters )
+ {
+ return false;
+ }
+
+ if( group1.mWordsLayoutInfo.size() != group2.mWordsLayoutInfo.size() )
+ {
+ return false;
+ }
+
+ if( !TestEqual( group1.mSize.x, group2.mSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( group1.mSize.y, group2.mSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( group1.mAscender, group2.mAscender ) )
+ {
+ return false;
+ }
+
+ if( group1.mDirection != group2.mDirection )
+ {
+ return false;
+ }
+
+ for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it1 = group1.mWordsLayoutInfo.begin(), endIt1 = group1.mWordsLayoutInfo.end(),
+ it2 = group2.mWordsLayoutInfo.begin(), endIt2 = group2.mWordsLayoutInfo.end();
+ ( it1 != endIt1 ) && ( it2 != endIt2 );
+ ++it1, ++it2 )
+ {
+ if( !TestEqual( *it1, *it2 ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TestEqual( const TextViewProcessor::LineLayoutInfo& line1,
+ const TextViewProcessor::LineLayoutInfo& line2 )
+{
+ if( !TestEqual( line1.mSize.x, line2.mSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( line1.mSize.y, line2.mSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( line1.mAscender, line2.mAscender ) )
+ {
+ return false;
+ }
+
+ if( line1.mNumberOfCharacters != line2.mNumberOfCharacters )
+ {
+ return false;
+ }
+
+ if( line1.mWordGroupsLayoutInfo.size() != line2.mWordGroupsLayoutInfo.size() )
+ {
+ return false;
+ }
+
+ for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it1 = line1.mWordGroupsLayoutInfo.begin(), endIt1 = line1.mWordGroupsLayoutInfo.end(),
+ it2 = line2.mWordGroupsLayoutInfo.begin(), endIt2 = line2.mWordGroupsLayoutInfo.end();
+ ( it1 != endIt1 ) && ( it2 != endIt2 );
+ ++it1, ++it2 )
+ {
+ if( !TestEqual( *it1, *it2 ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TestEqual( const TextViewProcessor::TextLayoutInfo& text1,
+ const TextViewProcessor::TextLayoutInfo& text2 )
+{
+ if( !TestEqual( text1.mWholeTextSize.x, text2.mWholeTextSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( text1.mWholeTextSize.y, text2.mWholeTextSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( text1.mMaxWordWidth, text2.mMaxWordWidth ) )
+ {
+ return false;
+ }
+
+ if( text1.mNumberOfCharacters != text2.mNumberOfCharacters )
+ {
+ return false;
+ }
+
+ if( text1.mLinesLayoutInfo.size() != text2.mLinesLayoutInfo.size() )
+ {
+ return false;
+ }
+
+ for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it1 = text1.mLinesLayoutInfo.begin(), endIt1 = text1.mLinesLayoutInfo.end(),
+ it2 = text2.mLinesLayoutInfo.begin(), endIt2 = text2.mLinesLayoutInfo.end();
+ ( it1 != endIt1 ) && ( it2 != endIt2 );
+ ++it1, ++it2 )
+ {
+ if( !TestEqual( *it1, *it2 ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/**
+ * Splits the \e input word in two by the given \e position and checks the results with \e firstResult and \e lastResult.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment. i.e. "Split the word from the beginning. (position 0)".
+ * @param input The input word.
+ * @param position Where to split the word.
+ * @param firstResult First part of the split word.
+ * @param lastResult Last part of the split word.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestSplitWord( const std::string& description, const std::string& input, const size_t position, const std::string& firstResult, const std::string& lastResult, const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input word.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ // Get the input word
+ TextViewProcessor::WordLayoutInfo inputWordLayout;
+
+ if( !inputLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Create layout info for the first part of the result (after split the word)
+
+ Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
+ TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray firstResultStyledText;
+ MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( firstResultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ firstRelayoutData );
+
+ // Get the first result word
+ TextViewProcessor::WordLayoutInfo firstResultWordLayout;
+
+ if( !firstResultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ firstResultWordLayout = *( *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Create layout info for the last part of the result (after split the word)
+
+ Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
+ TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray lastResultStyledText;
+ MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( lastResultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ lastRelayoutData );
+
+ // Get the last result word
+ TextViewProcessor::WordLayoutInfo lastResultWordLayout;
+
+ if( !lastResultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ lastResultWordLayout = *( *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Split the word.
+
+ TextViewProcessor::WordLayoutInfo lastWordLayoutInfo;
+
+ SplitWord( position,
+ inputWordLayout,
+ lastWordLayoutInfo );
+
+ // Test results
+ if( !TestEqual( inputWordLayout, firstResultWordLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ if( !TestEqual( lastWordLayoutInfo, lastResultWordLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Splits the \e input group of words in two by the given \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment. i.e. "Split the group of words from the beginning. (wordPosition 0 and position 0)".
+ * @param input The input word.
+ * @param wordPosition Index to the word within the group where to split the group.
+ * @param position Where to split the word.
+ * @param firstResult First part of the split group of words.
+ * @param lastResult Last part of the split group of words.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestSplitWordGroup( const std::string& description,
+ const std::string& input,
+ const size_t wordPosition,
+ const size_t position,
+ const std::string& firstResult,
+ const std::string& lastResult,
+ const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input group of words.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ // Get the input group of words
+ TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
+
+ if( !inputLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Create layout info for the first part of the result (after split the group of words)
+
+ Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
+ TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray firstResultStyledText;
+ MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( firstResultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ firstRelayoutData );
+
+ // Get the first result group of words
+ TextViewProcessor::WordGroupLayoutInfo firstResultWordGroupLayout;
+
+ if( !firstResultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ firstResultWordGroupLayout = *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Create layout info for the last part of the result (after split the group of words)
+
+ Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
+ TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray lastResultStyledText;
+ MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( lastResultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ lastRelayoutData );
+
+ // Get the last result group of words
+ TextViewProcessor::WordGroupLayoutInfo lastResultWordGroupLayout;
+
+ if( !lastResultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ lastResultWordGroupLayout = *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Split the group of words.
+
+ TextViewProcessor::WordGroupLayoutInfo lastWordGroupLayoutInfo;
+
+ TextViewProcessor::TextInfoIndices indices( 0, 0, wordPosition, position );
+ SplitWordGroup( indices,
+ inputWordGroupLayout,
+ lastWordGroupLayoutInfo );
+
+ // Test results
+ if( !TestEqual( inputWordGroupLayout, firstResultWordGroupLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ if( !TestEqual( lastWordGroupLayoutInfo, lastResultWordGroupLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Splits the \e input line in two by the given \e groupPosition, \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment. i.e. "Split the line from the beginning. (groupPosition 0, wordPosition 0 and position 0)".
+ * @param input The input word.
+ * @param groupPosition Index to the group of words within the line where to split the line.
+ * @param wordPosition Index to the word within the group where to split the group.
+ * @param position Where to split the word.
+ * @param lineHeightOffset Offset between lines.
+ * @param firstResult First part of the split line.
+ * @param lastResult Last part of the split line.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestSplitLine( const std::string& description,
+ const std::string& input,
+ const size_t groupPosition,
+ const size_t wordPosition,
+ const size_t position,
+ const float lineHeightOffset,
+ const std::string& firstResult,
+ const std::string& lastResult,
+ const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input line.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast<Toolkit::Alignment::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( 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::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ),
+ true );
+
+ switch( operation )
+ {
+ case Insert:
+ {
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( inputText, inputStyledText, true );
+
+ TextViewProcessor::UpdateTextInfo( position,
+ inputStyledText,
+ layoutParameters,
+ relayoutData );
+ break;
+ }
+ case Remove:
+ {
+ TextViewProcessor::UpdateTextInfo( position,
+ numberOfCharacters,
+ layoutParameters,
+ relayoutData,
+ TextViewProcessor::CLEAR_TEXT );
+ break;
+ }
+ case Replace:
+ {
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( inputText, inputStyledText, true );
+
+ TextViewProcessor::UpdateTextInfo( position,
+ numberOfCharacters,
+ inputStyledText,
+ layoutParameters,
+ relayoutData );
+ break;
+ }
+ default:
+ {
+ tet_printf( "TestUpdateTextInfo: unknown update operation. %s", location );
+ return false;
+ }
+ }
+
+ if( !TestEqual( inputLayout, resultLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+
+ std::cout << " result : "; Print( inputLayout );
+ std::cout << " expected result : "; Print( resultLayout );
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace
+
+
+int UtcDaliTextViewCreateTextInfo(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCreateTextInfo : ");
+
+ // Metrics for characters
+
+ // Font size = 10
+ // size : [9.48351, 9.48351]
+ // advance : 9.48351
+ // bearing : 8.53516
+ // ascender : 8.53516
+
+ // Font size = 12
+ // size : [11.3802, 11.3802]
+ // advance : 11.3802
+ // bearing : 10.2422
+ // ascender : 10.2422
+
+ // Font size = 14
+ // size : [13.2769, 13.2769]
+ // advance : 13.2769
+ // bearing : 11.9492
+ // ascender : 11.9492
+
+ const float WIDTH_10( 9.48351f );
+ const float HEIGHT_10( 9.48351f );
+ const float ADVANCE_10( 9.48351f );
+ const float BEARING_10( 8.53516f );
+ const float ASCENDER_10( 8.53516f );
+
+ const float WIDTH_12( 11.3802f );
+ const float HEIGHT_12( 11.3802f );
+ const float ADVANCE_12( 11.3802f );
+ const float BEARING_12( 10.2422f );
+ const float ASCENDER_12( 10.2422f );
+
+
+ // Generate a text.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo( relayoutData.mTextLayoutInfo );
+
+ std::string text( "Hel<font size='10'>lo wo</font>rld!\n"
+ "\n" );
+
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( text, styledText, true );
+
+ TextViewProcessor::CreateTextInfo( styledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+
+ // Build the text info with metric values.
+
+ // Characters
+
+ TextViewProcessor::CharacterLayoutInfo layoutInfo10; // ( [lo wo])
+ layoutInfo10.mHeight = HEIGHT_10;
+ layoutInfo10.mAdvance = ADVANCE_10;
+ layoutInfo10.mBearing = BEARING_10;
+ layoutInfo10.mSize = Size( WIDTH_10, HEIGHT_10 );
+ layoutInfo10.mAscender = ASCENDER_10;
+ TextViewProcessor::CharacterLayoutInfo layoutInfo12; // ( [Hel], [rld!] and [CR])
+ layoutInfo12.mHeight = HEIGHT_12;
+ layoutInfo12.mAdvance = ADVANCE_12;
+ layoutInfo12.mBearing = BEARING_12;
+ layoutInfo12.mSize = Size( WIDTH_12, HEIGHT_12 );
+ layoutInfo12.mAscender = ASCENDER_12;
+
+ TextStyle style10;
+ style10.SetFontPointSize( PointSize( 10.f ) );
+ TextStyle style12;
+ style12.SetFontPointSize( PointSize( 0.f ) ); // point size is set to zero because is a default point size.
+
+ layoutInfo12.mStyledText.mStyle = style12;
+ layoutInfo10.mStyledText.mStyle = style10;
+
+ // Words
+
+ TextViewProcessor::WordLayoutInfo wordLayout1, wordLayout2, wordLayout3, wordLayout4;
+
+ // Hello
+ wordLayout1.mSize = Size( 3.f * WIDTH_12 + 2.f * WIDTH_10, HEIGHT_12 );
+ wordLayout1.mAscender = ASCENDER_12;
+ wordLayout1.mType = TextViewProcessor::NoSeparator;
+
+ layoutInfo12.mStyledText.mText = Text( "H" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // H
+ layoutInfo12.mStyledText.mText = Text( "e" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // e
+ layoutInfo12.mStyledText.mText = Text( "l" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l
+ layoutInfo10.mStyledText.mText = Text( "l" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // l
+ layoutInfo10.mStyledText.mText = Text( "o" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o
+
+ // (white space)
+ wordLayout2.mSize = Size( WIDTH_10, HEIGHT_10 );
+ wordLayout2.mAscender = ASCENDER_10;
+ wordLayout2.mType = TextViewProcessor::WordSeparator;
+ layoutInfo10.mStyledText.mText = Text( " " );
+ wordLayout2.mCharactersLayoutInfo.push_back( layoutInfo10 ); // (white space)
+
+ // world!
+ wordLayout3.mSize = Size( 2.f * WIDTH_10 + 4.f * WIDTH_12, HEIGHT_12 );
+ wordLayout3.mAscender = ASCENDER_12;
+ wordLayout3.mType = TextViewProcessor::NoSeparator;
+ layoutInfo10.mStyledText.mText = Text( "w" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // w
+ layoutInfo10.mStyledText.mText = Text( "o" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o
+ layoutInfo12.mStyledText.mText = Text( "r" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // r
+ layoutInfo12.mStyledText.mText = Text( "l" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l
+ layoutInfo12.mStyledText.mText = Text( "d" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // d
+ layoutInfo12.mStyledText.mText = Text( "!" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // !
+
+ // (new line character)
+ wordLayout4.mSize = Size( 0.f, HEIGHT_12 );
+ wordLayout4.mAscender = ASCENDER_12;
+ wordLayout4.mType = TextViewProcessor::LineSeparator;
+ layoutInfo12.mStyledText.mText = Text( "\n" );
+ layoutInfo12.mSize.width = 0.f;
+ wordLayout4.mCharactersLayoutInfo.push_back( layoutInfo12 ); // (new line char)
+
+ // Groups
+
+ TextViewProcessor::WordGroupLayoutInfo groupLayout1, groupLayout2;
+
+ groupLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
+ groupLayout1.mAscender = ASCENDER_12;
+ groupLayout1.mDirection = TextViewProcessor::LTR;
+ groupLayout1.mNumberOfCharacters = 13;
+ groupLayout1.mWordsLayoutInfo.push_back( wordLayout1 );
+ groupLayout1.mWordsLayoutInfo.push_back( wordLayout2 );
+ groupLayout1.mWordsLayoutInfo.push_back( wordLayout3 );
+ groupLayout1.mWordsLayoutInfo.push_back( wordLayout4 );
+
+ groupLayout2.mSize = Size( 0.f, HEIGHT_12 );
+ groupLayout2.mAscender = ASCENDER_12;
+ groupLayout2.mDirection = TextViewProcessor::LTR;
+ groupLayout2.mNumberOfCharacters = 1;
+ groupLayout2.mWordsLayoutInfo.push_back( wordLayout4 );
+
+ // Lines
+
+ TextViewProcessor::LineLayoutInfo lineLayout1, lineLayout2, lineLayout3;
+
+ lineLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
+ lineLayout1.mAscender = ASCENDER_12;
+ lineLayout1.mNumberOfCharacters = 13;
+ lineLayout1.mWordGroupsLayoutInfo.push_back( groupLayout1 );
+
+ lineLayout2.mSize = Size( 0.f, HEIGHT_12 );
+ lineLayout2.mAscender = ASCENDER_12;
+ lineLayout2.mNumberOfCharacters = 1;
+ lineLayout2.mWordGroupsLayoutInfo.push_back( groupLayout2 );
+
+ lineLayout3.mSize = Size( 0.f, HEIGHT_12 );
+
+ // Text (layout)
+ TextViewProcessor::TextLayoutInfo textLayout;
+
+ textLayout.mWholeTextSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, 3.f * HEIGHT_12 );
+ textLayout.mMaxWordWidth = 2.f * WIDTH_10 + 4.f * WIDTH_12;
+ textLayout.mNumberOfCharacters = 14;
+ textLayout.mLinesLayoutInfo.push_back( lineLayout1 );
+ textLayout.mLinesLayoutInfo.push_back( lineLayout2 );
+ textLayout.mLinesLayoutInfo.push_back( lineLayout3 );
+
+ if(!TestEqual( textLayout, textLayoutInfo ))
+ {
+ std::cout << "Layout fails" << std::endl;
+ Print(textLayout); std::cout << std::endl;
+ Print(textLayoutInfo); std::cout << std::endl;
+ }
+
+ DALI_TEST_CHECK( TestEqual( textLayout, textLayoutInfo ) );
+ END_TEST;
+}
+
+int UtcDaliTextViewSplitWord(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitWord : ");
+
+ struct SplitWordTest splitWordTests[] =
+ {
+ {
+ std::string( "Split word, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 0,
+ std::string( "" ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ },
+ {
+ std::string( "Split word, position 8." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 8,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ std::string( "" ),
+ },
+ {
+ std::string( "Split word, position 2." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 2,
+ std::string( "<font size='10'>He</font>" ),
+ std::string( "<font size='12'>ll</font><font size='10'>oooo</font>" ),
+ },
+ {
+ std::string( "Split word, position 3." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 3,
+ std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
+ std::string( "<font size='12'>l</font><font size='10'>oooo</font>" ),
+ },
+ {
+ std::string( "Split word, position 4." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ 4,
+ std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
+ std::string( "<font size='10'>oooo</font>" ),
+ },
+ };
+ const std::size_t numberOfTests( 5 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitWordTest& test = splitWordTests[index];
+
+ if( !TestSplitWord( test.description, test.input, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewUpdateTextInfo(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewUpdateTextInfo : ");
+
+ struct UpdateTextInfoTest updateTextInfoTest[] =
+ {
+ // Remove operations
+
+ {
+ std::string( "Remove from new line character to first character next line." ),
+ Remove,
+ std::string("Hello world\nhello world."),
+ 11,
+ 2,
+ std::string(""),
+ 0.f,
+ std::string("Hello worldello world."),
+ },
+ {
+ std::string( "Replace style from new line character to first character next line." ),
+ Replace,
+ std::string("Hello world\nhello world."),
+ 11,
+ 2,
+ std::string("<b>\nh</b>"),
+ 0.f,
+ std::string("Hello world<b>\nh</b>ello 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 <font size='30'>world\nhello</font> world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='30'>wd\nhello</font> 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 <font size='30'>w<font size='20'>orl</font>d\nhello</font> world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='30'>wd\nhello</font> 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 <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='30'>w</font><font size='10'>d\nhello</font> world" )
+ },
+ // * Remove whole word (merge words)
+ {
+ std::string( "Remove within the same word, whole word (merge words)" ),
+ Remove,
+ std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
+ 5,
+ 1,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello<font size='30'>w</font>orl<font size='10'>d\nhello</font> 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 <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
+ 6,
+ 5,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='10'>\nhello</font> world" )
+ },
+ // * Remove whole word (merge lines)
+ {
+ std::string( "Remove within the same word, whole word (merge lines)" ),
+ Remove,
+ std::string("Hello <font size='30'>w</font>orl<font size='10'>d\nhello</font> world"),
+ 11,
+ 1,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello <font size='30'>w</font>orl<font size='10'>dhello</font> 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 <font color='green'>world</font>" ),
+ 0,
+ 7,
+ std::string( "<font color='red'>Hello w</font>" ),
+ 0.f,
+ std::string( "<font color='red'>Hello w</font><font color='green'>orld</font>" )
+ },
+ {
+ std::string( "Replace style from the middle of the text to the end." ),
+ Replace,
+ std::string( "Touch me\nhello" ),
+ 6,
+ 8,
+ std::string( "<b>me\nhello</b>" ),
+ 0.f,
+ std::string( "Touch <b>me\nhello</b>" )
+ },
+ {
+ 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( "<b>me\nhello</b>" ),
+ 0.f,
+ std::string( "Touch <b>me\nhello</b>\nworld" )
+ },
+ {
+ std::string( "Replace style from the middle of the text 1." ),
+ Replace,
+ std::string( "Touch me\nhello\nworld" ),
+ 6,
+ 8,
+ std::string( "<b>me\nhello</b>" ),
+ 0.f,
+ std::string( "Touch <b>me\nhello</b>\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( "<b>me\nhello\n</b>" ),
+ 0.f,
+ std::string( "Touch <b>me\nhello\n</b>world" )
+ },
+ };
+ const std::size_t numberOfTests( 21 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const UpdateTextInfoTest& test = updateTextInfoTest[index];
+
+ if( !TestUpdateTextInfo( test.description, test.operation, test.input, test.position, test.numberOfCharacters, test.inputText, test.lineHeightOffset, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewSplitWordGroup(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitWordGroup : ");
+
+ struct SplitWordGroupTest splitWordGroupTests[] =
+ {
+ {
+ std::string( "Split word group, wordPosition 0, position 0." ),
+ std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
+ 0,
+ 0,
+ std::string( "" ),
+ std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 2, position 8." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 2,
+ 7,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ std::string( "" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 2." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 0,
+ 2,
+ std::string( "<font size='10'>He</font>" ),
+ std::string( "<font size='12'>ll</font><font size='10'>oooo wooorld</font>" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 3." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 0,
+ 3,
+ std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
+ std::string( "<font size='12'>l</font><font size='10'>oooo wooorld</font>" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 4." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 0,
+ 4,
+ std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
+ std::string( "<font size='10'>oooo wooorld</font>" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 1, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
+ 1,
+ 0,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
+ std::string( "<font size='10'> wooorld</font>" ),
+ },
+ };
+ const std::size_t numberOfTests( 6 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitWordGroupTest& test = splitWordGroupTests[index];
+
+ if( !TestSplitWordGroup( test.description, test.input, test.wordPosition, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewSplitLine(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitLine : ");
+
+ struct SplitLineTest splitLineTests[] =
+ {
+ {
+ std::string( "Split line, groupPosition 0, wordPosition 0, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 0,
+ 0,
+ 0,
+ 3.f,
+ std::string( "" ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ },
+ {
+ std::string( "Split line, groupPosition 2, wordPosition 2, position 4." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 2,
+ 2,
+ 4,
+ 0.f,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ std::string( "" ),
+ },
+ /* TODO check when RTL is working.
+ {
+ std::string( "Split line, groupPosition 1, wordPosition 2, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 1,
+ 2,
+ 0,
+ 0.f,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום" ),
+ std::string( " עולם text text" ),
+ },
+ {
+ std::string( "Split line, groupPosition 1, wordPosition 0, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 1,
+ 0,
+ 0,
+ 0.f,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> " ),
+ std::string( "שלום עולם text text" ),
+ },
+ */
+ {
+ std::string( "Split line, groupPosition 2, wordPosition 0, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 2,
+ 0,
+ 0,
+ 6.f,
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם " ),
+ std::string( "text text" ),
+ },
+ };
+ const std::size_t numberOfTests( 3 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitLineTest& test = splitLineTests[index];
+
+ if( !TestSplitLine( test.description, test.input, test.groupPosition, test.wordPosition, test.position, test.lineHeightOffset, test.firstResult, test.lastResult, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewMergeWord01(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeWord01 : ");
+
+ struct MergeWordsTest mergeWordsTests[] =
+ {
+ {
+ std::string( "Merge words with same style." ),
+ std::string( "Hel" ),
+ std::string( "lo" ),
+ std::string( "Hello" ),
+ },
+ {
+ std::string( "Merge words with different styles." ),
+ std::string( "<font size='10>Hel</font>" ),
+ std::string( "<font size='20'>lo</font>" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>lo</font>" )
+ },
+ };
+ const std::size_t numberOfTests( 2 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const MergeWordsTest& test = mergeWordsTests[index];
+
+ if( !TestMergeWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewMergeWord02(void)
+{
+ // Negative test.
+ // It test white spaces and new line characters can't be merged to other words.
+
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeWord02 : ");
+
+ // Generate three words
+
+ Toolkit::Internal::TextView::RelayoutData relayoutData01;
+ Toolkit::Internal::TextView::RelayoutData relayoutData02;
+ Toolkit::Internal::TextView::RelayoutData relayoutData03;
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
+
+ std::string text01( " " );
+ std::string text02( "\n" );
+ std::string text03( "a" );
+ MarkupProcessor::StyledTextArray styledText01;
+ MarkupProcessor::StyledTextArray styledText02;
+ MarkupProcessor::StyledTextArray styledText03;
+ MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
+ MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
+ MarkupProcessor::GetStyledTextArray( text03, styledText03, true );
+
+ TextViewProcessor::CreateTextInfo( styledText01,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData01 );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo01;
+
+ wordLayoutInfo01 = *( *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText02,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData02 );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo02;
+
+ wordLayoutInfo02 = *( *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText03,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData03 );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo03;
+
+ wordLayoutInfo03 = *( *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+
+ // Test MergeWord() asserts if white spaces or new line chars are merged.
+ bool assert1 = false;
+ bool assert2 = false;
+ bool assert3 = false;
+ bool assert4 = false;
+ bool assert5 = false;
+ bool assert6 = false;
+
+ try
+ {
+ MergeWord( wordLayoutInfo01,
+ wordLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert1 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo01,
+ wordLayoutInfo03 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert2 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo02,
+ wordLayoutInfo01 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert3 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo02,
+ wordLayoutInfo03 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert4 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo03,
+ wordLayoutInfo01 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert5 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo03,
+ wordLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert6 = true;
+ }
+
+ if( assert1 && assert2 && assert3 && assert4 && assert5 && assert6 )
+ {
+ tet_result( TET_PASS );
+ }
+ else
+ {
+ tet_result( TET_FAIL );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextViewMergeGroup01(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeGroup01 : ");
+
+ struct MergeWordGroupsTest mergeWordGroupssTests[] =
+ {
+ {
+ std::string( "Merge a void first group." ),
+ std::string( "" ),
+ std::string( "Hello world" ),
+ std::string( "Hello world" ),
+ },
+ {
+ std::string( "Merge a void last group." ),
+ std::string( "Hello world" ),
+ std::string( "" ),
+ std::string( "Hello world" ),
+ },
+ {
+ std::string( "Merge groups and merge last and first words." ),
+ std::string( "Hello wor" ),
+ std::string( "ld, hello world" ),
+ std::string( "Hello world, hello world" ),
+ },
+ {
+ std::string( "Merge groups and don't merge last and first words." ),
+ std::string( "Hello world, " ),
+ std::string( "hello world" ),
+ std::string( "Hello world, hello world" )
+ },
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const MergeWordGroupsTest& test = mergeWordGroupssTests[index];
+
+ if( !TestMergeGroupsOfWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewMergeGroup02(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeGroup02 : ");
+
+ Toolkit::Internal::TextView::RelayoutData relayoutData01;
+ Toolkit::Internal::TextView::RelayoutData relayoutData02;
+ Toolkit::Internal::TextView::RelayoutData relayoutData03;
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
+
+ std::string text01( "Hello \n" );
+ std::string text02( "world" );
+ std::string text03( "السلام عليكم" );
+ MarkupProcessor::StyledTextArray styledText01;
+ MarkupProcessor::StyledTextArray styledText02;
+ MarkupProcessor::StyledTextArray styledText03;
+ MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
+ MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
+ MarkupProcessor::GetStyledTextArray( text03, styledText03, true );
+
+ TextViewProcessor::CreateTextInfo( styledText01,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData01 );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo01;
+
+ wordGroupLayoutInfo01 = *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText02,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData02 );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo02;
+
+ wordGroupLayoutInfo02 = *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText03,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData03 );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo03;
+
+ wordGroupLayoutInfo03 = *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+
+ bool assert1 = false;
+ bool assert2 = false;
+
+ try
+ {
+ MergeWordGroup( wordGroupLayoutInfo01,
+ wordGroupLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: A group of words can't be merged to another group which finishes with a new line character.\"", TEST_LOCATION );
+ assert1 = true;
+ }
+
+ try
+ {
+ MergeWordGroup( wordGroupLayoutInfo03,
+ wordGroupLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: groups with different direction can't be merged.\"", TEST_LOCATION );
+ assert2 = true;
+ }
+
+ if( assert1 && assert2 )
+ {
+ tet_result( TET_PASS );
+ }
+ else
+ {
+ tet_result( TET_FAIL );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextViewMergeLine01(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeLine01 : ");
+
+ struct MergeLinesTest mergeLinesTests[] =
+ {
+ {
+ std::string( "Merge a void first line." ),
+ std::string( "" ),
+ std::string( "Hello world, this is a whole line" ),
+ 2.f,
+ std::string( "Hello world, this is a whole line" )
+ },
+ {
+ std::string( "Merge a void last line." ),
+ std::string( "Hello world, this is a whole line" ),
+ std::string( "" ),
+ 0.f,
+ std::string( "Hello world, this is a whole line" )
+ },
+ /* TODO: check when RTL text is working.
+ {
+ std::string( "Merge lines and merge last and first groups" ),
+ std::string( "Hello world, שלום" ),
+ std::string( " עולם, hello world." ),
+ 6.f,
+ std::string( "Hello world, שלום עולם, hello world." )
+ },
+ {
+ std::string( "Merge lines and don't merge last and first words." ),
+ std::string( "Hello world, " ),
+ std::string( "שלום עולם, hello world." ),
+ 3.f,
+ std::string( "Hello world, שלום עולם, hello world." )
+ },
+ */
+ {
+ std::string( "Merge lines. Don't merge words" ),
+ std::string( "Hello world," ),
+ std::string( " this is a whole line" ),
+ 0.f,
+ std::string( "Hello world, this is a whole line" )
+ },
+ {
+ std::string( "Merge lines. Merge words" ),
+ std::string( "Hello world, th" ),
+ std::string( "is is a whole line" ),
+ 0.f,
+ std::string( "Hello world, this is a whole line" )
+ },
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const MergeLinesTest& test = mergeLinesTests[index];
+
+ if( !TestMergeLines( test.description, test.inputFirst, test.inputLast, test.lineHeightOffset, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewMergeLine02(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeLine02 : ");
+
+ Toolkit::Internal::TextView::RelayoutData relayoutData01;
+ Toolkit::Internal::TextView::RelayoutData relayoutData02;
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
+
+ std::string text01( "Hello world\n" );
+ std::string text02( "hello world" );
+ MarkupProcessor::StyledTextArray styledText01;
+ MarkupProcessor::StyledTextArray styledText02;
+ MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
+ MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
+
+ TextViewProcessor::CreateTextInfo( styledText01,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData01 );
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo01;
+
+ lineLayoutInfo01 = *textLayoutInfo01.mLinesLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText02,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData02 );
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo02;
+
+ lineLayoutInfo02 = *textLayoutInfo02.mLinesLayoutInfo.begin();
+
+ bool assert1 = false;
+
+ try
+ {
+ MergeLine( lineLayoutInfo01,
+ lineLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeLine(). ERROR: A line can't be merged to another line which finishes with a new line character.\"", TEST_LOCATION );
+ assert1 = true;
+ }
+
+ if( assert1 )
+ {
+ tet_result( TET_PASS );
+ }
+ else
+ {
+ tet_result( TET_FAIL );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextViewRemoveCharactersFromWord(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeWord02 : ");
+
+ struct RemoveCharactersFromWordTest removeCharactersFromWordTests[] =
+ {
+ {
+ std::string( "Delete 0 characters." ),
+ std::string( "Hello" ),
+ 3,
+ 0,
+ std::string( "Hello" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Starting from the beginning" ),
+ std::string( "Hello" ),
+ 0,
+ 3,
+ std::string( "lo" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Somewhere in the middle" ),
+ std::string( "Hello" ),
+ 2,
+ 2,
+ std::string( "Heo" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Starting somewhere in the middle to the end" ),
+ std::string( "Hello" ),
+ 3,
+ 2,
+ std::string( "Hel" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Finish just before a new one." ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 1,
+ 2,
+ std::string( "<font size='10'>H</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ },
+ {
+ std::string( "Delete starting in one group of characters and finishing in a different one. No merge of groups." ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 2,
+ 3,
+ std::string( "<font size='10'>He</font><font size='20'>Wo</font><font size='30'>rld</font>" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Starting just after a different one." ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 7,
+ 2,
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>d</font>" ),
+ },
+ {
+ std::string( "Delete whole group of characters. No merge" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 3,
+ 4,
+ std::string( "<font size='10'>Hel</font><font size='30'>rld</font>" ),
+ },
+ {
+ std::string( "Delete whole group of characters and part of the adjacent ones. No merge" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='30'>rld</font>" ),
+ 2,
+ 6,
+ std::string( "<font size='10'>He</font><font size='30'>ld</font>" ),
+ },
+ {
+ std::string( "Delete whole group of characters. Merge" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
+ 3,
+ 4,
+ std::string( "<font size='10'>Helrld</font>" ),
+ },
+ {
+ std::string( "Delete whole group of characters and part of the adjacent ones. Merge" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>loWo</font><font size='10'>rld</font>" ),
+ 2,
+ 6,
+ std::string( "<font size='10'>Held</font>" ),
+ },
+ };
+ const std::size_t numberOfTests( 11 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const RemoveCharactersFromWordTest& test = removeCharactersFromWordTests[index];
+
+ if( !TestRemoveCharactersFromWord( test.description, test.input, test.position, test.numberOfCharacters, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewRemoveWordsFromGroup(void)
+{
+ // Note: Currently RemoveWordsFromWordGroup() function is only used to remove a number of words from the beginning, or
+ // from a given index to the end. RemoveWordsFromWordGroup() doesn't merge words (if a white space is removed) so
+ // tehere isn't any TET case to cover these cases. To be done if needed.
+
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewRemoveWordsFromGroup : ");
+ struct RemoveWordsFromGroupTest removeWordsFromGroupTests[] =
+ {
+ {
+ std::string( "Delete 0 words." ),
+ std::string( "Hello world, hello world" ),
+ 3,
+ 0,
+ std::string( "Hello world, hello world" ),
+ },
+ {
+ std::string( "Delete some words in the middle. Don't merge words" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
+ 1,
+ 4,
+ std::string( "<font size='10'>Hel</font><font size='20'>lo</font><font size='30'> world</font>" ),
+ },
+ {
+ std::string( "Delete words up to the end" ),
+ std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
+ 5,
+ 2,
+ std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello</font>" ),
+ },
+ {
+ std::string( "Delete words from the beginning." ),
+ std::string( "Hello world, hello world" ),
+ 0,
+ 3,
+ std::string( " hello world" ),
+ },
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const RemoveWordsFromGroupTest& test = removeWordsFromGroupTests[index];
+
+ if( !TestRemoveWordsFromGroup( test.description, test.input, test.wordIndex, test.numberOfWords, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
+
+int UtcDaliTextViewRemoveGroupsFromLine(void)
+{
+ // Note: Currently RemoveWordGroupsFromLine() function is only used to remove a number of group of words from the beginning, or
+ // from a given index to the end. RemoveWordGroupsFromLine() doesn't merge groups of words (if a whole group of words is removed) so
+ // tehere isn't any TET case to cover these cases. To be done if needed.
+
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewRemoveGroupsFromLine : ");
+ struct RemoveGroupsFromLineTest removeGroupsFromLineTests[] =
+ {
+ {
+ std::string( "Delete 0 groups of words." ),
+ std::string( "Hello hello, שלום עולם hello hello" ),
+ 1,
+ 0,
+ 2.f,
+ std::string( "Hello hello, שלום עולם hello hello" ),
+ },
+ {
+ std::string( "Delete from the middle to the end." ),
+ std::string( "Hello hello, שלום עולם hello hello" ),
+ 1,
+ 2,
+ 0.f,
+ std::string( "Hello hello, " ),
+ },
+ {
+ std::string( "Delete from the beginning to the middle." ),
+ std::string( "Hello hello, שלום עולם hello hello" ),
+ 0,
+ 2,
+ 6.f,
+ std::string( "hello hello" ),
+ },
+ };
+ const std::size_t numberOfTests( 3 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const RemoveGroupsFromLineTest& test = removeGroupsFromLineTests[index];
+
+ if( !TestRemoveGroupsFromLine( test.description, test.input, test.groupIndex, test.numberOfGroups, test.lineHeightOffset, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+ END_TEST;
+}
--- /dev/null
+SET(PKG_NAME "dali-toolkit-unmanaged")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-core")
+SET(RPM_NAME "core-${PKG_NAME}-tests")
+
+SET(CAPI_LIB "dali-toolkit-unmanaged")
+
+# List of test case sources (Only these get parsed for test cases)
+SET(TC_SOURCES
+ utc-Dali-AlbumLayout.cpp
+ utc-Dali-BendyEffect.cpp
+ utc-Dali-BlindEffect.cpp
+ utc-Dali-BloomView.cpp
+ utc-Dali-Builder.cpp
+ utc-Dali-CarouselEffect.cpp
+ utc-Dali-CheckBoxButton.cpp
+ utc-Dali-Cluster.cpp
+ utc-Dali-CubeTransitionEffect.cpp
+ utc-Dali-DepthLayout.cpp
+ utc-Dali-DisplacementEffect.cpp
+ utc-Dali-DistanceFieldEffect.cpp
+ utc-Dali-GaussianBlurView.cpp
+ utc-Dali-JsonParser.cpp
+ utc-Dali-KeyInputFocusManager.cpp
+ utc-Dali-NavigationControl.cpp
+ utc-Dali-NavigationLayout.cpp
+ utc-Dali-OverlayEffect.cpp
+ utc-Dali-Page.cpp
+ utc-Dali-PageTurnEffect.cpp
+ utc-Dali-PageTurnView.cpp
+ utc-Dali-RollLayout.cpp
+ utc-Dali-RotatingSelector.cpp
+ utc-Dali-ScrollView.cpp
+ utc-Dali-ShadowView.cpp
+ utc-Dali-ShearEffect.cpp
+ utc-Dali-Slider.cpp
+ utc-Dali-SoftButtonEffect.cpp
+ utc-Dali-SpiralLayout.cpp
+ utc-Dali-SpotEffect.cpp
+ utc-Dali-SquareDissolveEffect.cpp
+ utc-Dali-TableView.cpp
+ utc-Dali-ToolBar.cpp
+ utc-Dali-View.cpp
+ utc-Dali-WaterEffect.cpp
+ utc-Dali-Button.cpp
+ utc-Dali-ControlImpl.cpp
+ utc-Dali-DefaultControls.cpp
+ utc-Dali-ItemView.cpp
+ utc-Dali-KeyboardFocusManager.cpp
+ utc-Dali-ScrollViewEffect.cpp
+ utc-Dali-TextInput.cpp
+)
+
+# Append list of test harness files (Won't get parsed for test cases)
+LIST(APPEND TC_SOURCES
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
+)
+
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ dali-core
+ dali
+ dali-toolkit
+)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type")
+
+FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS})
+ SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}")
+ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS})
+
+INCLUDE_DIRECTORIES(
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+ ../dali-toolkit/dali-toolkit-test-utils
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${EXEC_NAME}
+)
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include "tct-dali-toolkit-unmanaged-core.h"
+
+int main(int argc, const char *argv[])
+{
+ int result = -1;
+ int i;
+
+ if (argc != 2) {
+ printf("Usage: %s <testcase name>\n", argv[0]);
+ return 2;
+ }
+
+ for (i = 0; tc_array[i].name; i++) {
+ if (!strcmp(argv[1], tc_array[i].name)) {
+ if (tc_array[i].startup)
+ tc_array[i].startup();
+
+ result = tc_array[i].function();
+
+ if (tc_array[i].cleanup)
+ tc_array[i].cleanup();
+
+ return result;
+ }
+ }
+
+ printf("Unknown testcase name: \"%s\"\n", argv[1]);
+ return 2;
+}
--- /dev/null
+#ifndef __TCT_DALI_TOOLKIT_UNMANAGED_CORE_H__
+#define __TCT_DALI_TOOLKIT_UNMANAGED_CORE_H__
+
+#include "testcase.h"
+
+extern void album_layout_startup(void);
+extern void album_layout_cleanup(void);
+extern void bendy_effect_startup(void);
+extern void bendy_effect_cleanup(void);
+extern void blind_effect_startup(void);
+extern void blind_effect_cleanup(void);
+extern void bloom_view_startup(void);
+extern void bloom_view_cleanup(void);
+extern void builder_startup(void);
+extern void builder_cleanup(void);
+extern void carousel_effect_startup(void);
+extern void carousel_effect_cleanup(void);
+extern void checkbox_button_startup(void);
+extern void checkbox_button_cleanup(void);
+extern void cluster_startup(void);
+extern void cluster_cleanup(void);
+extern void cube_transition_effect_startup(void);
+extern void cube_transition_effect_cleanup(void);
+extern void depth_layout_startup(void);
+extern void depth_layout_cleanup(void);
+extern void utc_displacement_startup(void);
+extern void utc_displacement_cleanup(void);
+extern void utc_distance_field_effect_startup(void);
+extern void utc_distance_field_effect_cleanup(void);
+extern void utc_gaussian_blur_view_startup(void);
+extern void utc_gaussian_blur_view_cleanup(void);
+extern void utc_json_parser_startup(void);
+extern void utc_json_parser_cleanup(void);
+extern void key_input_focus_manager_startup(void);
+extern void key_input_focus_manager_cleanup(void);
+extern void navigation_control_startup(void);
+extern void navigation_control_cleanup(void);
+extern void overlay_effect_startup(void);
+extern void overlay_effect_cleanup(void);
+extern void dali_page_startup(void);
+extern void dali_page_cleanup(void);
+extern void page_turn_effect_startup(void);
+extern void page_turn_effect_cleanup(void);
+extern void dali_page_turn_view_startup(void);
+extern void dali_page_turn_view_cleanup(void);
+extern void dali_roll_layout_startup(void);
+extern void dali_roll_layout_cleanup(void);
+extern void rotating_selector_startup(void);
+extern void rotating_selector_cleanup(void);
+extern void scroll_view_startup(void);
+extern void scroll_view_cleanup(void);
+extern void shadow_view_startup(void);
+extern void shadow_view_cleanup(void);
+extern void shear_effect_startup(void);
+extern void shear_effect_cleanup(void);
+extern void dali_slider_startup(void);
+extern void dali_slider_cleanup(void);
+extern void soft_button_effect_startup(void);
+extern void soft_button_effect_cleanup(void);
+extern void spiral_layout_startup(void);
+extern void spiral_layout_cleanup(void);
+extern void spot_effect_startup(void);
+extern void spot_effect_cleanup(void);
+extern void square_dissolve_effect_startup(void);
+extern void square_dissolve_effect_cleanup(void);
+extern void dali_tableview_startup(void);
+extern void dali_tableview_cleanup(void);
+extern void dali_toolbar_startup(void);
+extern void dali_toolbar_cleanup(void);
+extern void dali_view_startup(void);
+extern void dali_view_cleanup(void);
+extern void dali_water_effect_startup(void);
+extern void dali_water_effect_cleanup(void);
+extern void dali_button_startup(void);
+extern void dali_button_cleanup(void);
+extern void control_impl_startup(void);
+extern void control_impl_cleanup(void);
+extern void dali_default_controls_startup(void);
+extern void dali_default_controls_cleanup(void);
+extern void dali_keyboard_focus_manager_startup(void);
+extern void dali_keyboard_focus_manager_cleanup(void);
+extern void dali_scroll_view_effect_startup(void);
+extern void dali_scroll_view_effect_cleanup(void);
+
+extern int UtcDaliAlbumLayoutNew(void);
+extern int UtcDaliAlbumSetAndGetItemSizeFunction(void);
+extern int UtcDaliAlbumSetAndGetScrollSpeedFactor(void);
+extern int UtcDaliAlbumSetAndGetMaximumSwipeSpeed(void);
+extern int UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration(void);
+extern int UtcDaliAlbumSetNumOfItems(void);
+extern int UtcDaliAlbumSetStackNum(void);
+extern int UtcDaliAlbumSetPosition(void);
+extern int UtcDaliAlbumSetRotationX(void);
+extern int UtcDaliAlbumSetRotationZ(void);
+extern int UtcDaliAlbumSetScale(void);
+extern int UtcDaliAlbumSetColor(void);
+extern int UtcDaliAlbumSetCenterPosition(void);
+extern int UtcDaliAlbumSetSetCenterScale(void);
+extern int UtcDaliAlbumSetSetCenterColor(void);
+extern int UtcDaliAlbumSetStackPosition(void);
+extern int UtcDaliAlbumSetSetStackScale(void);
+extern int UtcDaliAlbumSetStackColor(void);
+extern int UtcDaliBendyUninitializedEffect(void);
+extern int UtcDaliBendyPropertyNamesEffect(void);
+extern int UtcDaliBendyDefaultValuesEffect(void);
+extern int UtcDaliBendyCustomValuesEffect(void);
+extern int UtcDaliBlindEffectUninitialized(void);
+extern int UtcDaliBlindEffectPropertyNames(void);
+extern int UtcDaliBlindEffectDefaultValues(void);
+extern int UtcDaliBlindEffectCustomValues(void);
+extern int UtcDaliBloomViewUninitialized(void);
+extern int UtcDaliBloomViewNew(void);
+extern int UtcDaliBloomViewDownCast(void);
+extern int UtcDaliBloomViewPropertyNames(void);
+extern int UtcDaliBloomViewAddRemove(void);
+extern int UtcDaliBloomActivateDeactivate(void);
+extern int UtcDaliBuilderTextActorCreateFromStyle(void);
+extern int UtcDaliBuilderTextActorCreateAnimation(void);
+extern int UtcDaliBuilderTextActorApplyFromStyle(void);
+extern int UtcDaliBuilderAddActors(void);
+extern int UtcDaliBuilderAddActorsOther(void);
+extern int UtcDaliBuilderStyles(void);
+extern int UtcDaliBuilderSetProperty(void);
+extern int UtcDaliCarouselEffectUninitialized(void);
+extern int UtcDaliCarouselEffectPropertyNames(void);
+extern int UtcDaliCarouselEffectDefaultValues(void);
+extern int UtcDaliCarouselEffectCustomValues(void);
+extern int UtcDaliCheckBoxButtonSetGetChecked(void);
+extern int UtcDaliCheckBoxButtonSetImages(void);
+extern int UtcDaliClusterNew(void);
+extern int UtcDaliClusterDownCast(void);
+extern int UtcDaliClusterAddAndRemoveChild(void);
+extern int UtcDaliClusterExpandAndCollapseChild(void);
+extern int UtcDaliClusterSetAndGetStyle(void);
+extern int UtcDaliCubeTransitionWaveEffectNew(void);
+extern int UtcDaliCubeTransitionCrossEffectNew(void);
+extern int UtcDaliCubeTransitionFoldEffectNew(void);
+extern int UtcDaliCubeTransitionEffectSetGetTransitionDuration(void);
+extern int UtcDaliCubeTransitionEffectSetGetCubeDisplacement(void);
+extern int UtcDaliCubeTransitionEffectGetRoot(void);
+extern int UtcDaliCubeTransitionEffectIsTransiting(void);
+extern int UtcDaliCubeTransitionEffectSetCurrentImage(void);
+extern int UtcDaliCubeTransitionEffectSetTargetImage(void);
+extern int UtcDaliCubeTransitionWaveEffectStartTransition(void);
+extern int UtcDaliCubeTransitionCrossEffectStartTransition(void);
+extern int UtcDaliCubeTransitionFoldEffectStartTransition(void);
+extern int UtcDaliCubeTransitionEffectSignalTransitionCompleted(void);
+extern int UtcDaliCubeTransitionEffectPauseResumeTransition(void);
+extern int UtcDaliCubeTransitionWaveEffectStopTransition(void);
+extern int UtcDaliCubeTransitionCrossEffectStopTransition(void);
+extern int UtcDaliCubeTransitionFoldEffectStopTransition(void);
+extern int UtcDaliDepthLayoutNew(void);
+extern int UtcDaliDepthLayoutSetAndGetNumberOfColumns(void);
+extern int UtcDaliDepthLayoutSetAndGetNumberOfRows(void);
+extern int UtcDaliDepthLayoutSetAndGetRowSpacing(void);
+extern int UtcDaliDepthLayoutSetAndGetTiltAngle(void);
+extern int UtcDaliDepthLayoutSetAndGetItemSizeFunction(void);
+extern int UtcDaliDepthLayoutSetAndGetBottomMarginFunction(void);
+extern int UtcDaliDepthLayoutSetAndGetItemTiltAngle(void);
+extern int UtcDaliDepthLayoutSetAndGetColumnPositionFunction(void);
+extern int UtcDaliDepthLayoutSetAndGetScrollSpeedFactor(void);
+extern int UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed(void);
+extern int UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration(void);
+extern int UtcDaliDepthLayoutConstraintLeft(void);
+extern int UtcDaliDepthLayoutConstraintRight(void);
+extern int UtcDaliDepthLayoutConstraintUp(void);
+extern int UtcDaliDepthLayoutConstraintDown(void);
+extern int UtcDaliDepthLayoutGetScrollToPosition(void);
+extern int UtcDaliDepthLayoutScrollDirection(void);
+extern int UtcDaliDisplacementEffectUninitialized(void);
+extern int UtcDaliDisplacementEffectNew(void);
+extern int UtcDaliDisplacementEffectPropertyNames(void);
+extern int UtcDaliDisplacementEffectTestSetProperty(void);
+extern int UtcDaliDistanceFieldEffectUninitialized(void);
+extern int UtcDaliDistanceFieldEffectPropertyNames(void);
+extern int UtcDaliDistanceFieldEffectDefaultValues(void);
+extern int UtcDaliDistanceFieldEffectCustomValues(void);
+extern int UtcDaliGaussianBlurViewUninitialized(void);
+extern int UtcDaliGaussianBlurViewNew(void);
+extern int UtcDaliGaussianBlurViewDownCast(void);
+extern int UtcDaliGaussianBlurViewPropertyNames(void);
+extern int UtcDaliGaussianBlurViewAddRemove(void);
+extern int UtcDaliGaussianBlurActivateDeactivate(void);
+extern int UtcDaliGaussianBlurViewSetGetBackgroundColor(void);
+extern int UtcDaliGaussianBlurViewSetGetRenderTarget(void);
+extern int UtcDaliJsonParserMethod01(void);
+extern int UtcDaliJsonParserMethod02(void);
+extern int UtcDaliJsonParserMethod03(void);
+extern int UtcDaliJsonParserMethod04(void);
+extern int UtcDaliJsonParserMethod05(void);
+extern int UtcDaliJsonParserMethod06(void);
+extern int UtcDaliJsonParserMethod07(void);
+extern int UtcDaliJsonParserMethod08(void);
+extern int UtcDaliJsonParserMethod09(void);
+extern int UtcDaliJsonParserMethod10(void);
+extern int UtcDaliKeyInputFocusManagerGet(void);
+extern int UtcDaliKeyInputFocusManagerSetFocus(void);
+extern int UtcDaliKeyInputFocusManagerGetCurrentFocusControl(void);
+extern int UtcDaliKeyInputFocusManagerRemoveFocus(void);
+extern int UtcDaliKeyInputFocusManagerIsKeyboardListener(void);
+extern int UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged(void);
+extern int UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent(void);
+extern int UtcDaliNavigationControlNew(void);
+extern int UtcDaliNavigationControlDownCast(void);
+extern int UtcDaliNavigationControlPushItem(void);
+extern int UtcDaliNavigationControlPopItem(void);
+extern int UtcDaliNavigationControlGetItemCount(void);
+extern int UtcDaliNavigationControlGetItem(void);
+extern int UtcDaliNavigationControlGetCurrentItem(void);
+extern int UtcDaliNavigationControlSetBackground(void);
+extern int UtcDaliNavigationControlCreateNavigationToolBar(void);
+extern int UtcDaliNavigationControlCreateNavigationTitleBar(void);
+extern int UtcDaliNavigationLayoutNew(void);
+extern int UtcDaliNavigationLayoutColumns(void);
+extern int UtcDaliNavigationLayoutSetGetOrientation(void);
+extern int UtcDaliNavigationLayoutTestConstraintLeft(void);
+extern int UtcDaliNavigationLayoutTestConstraintRight(void);
+extern int UtcDaliNavigationLayoutTestConstraintUp(void);
+extern int UtcDaliNavigationLayoutTestConstraintDown(void);
+extern int UtcDaliNavigationLayoutScrollDirection(void);
+extern int UtcDaliNavigationLayoutSetGetColumnSpacing(void);
+extern int UtcDaliNavigationLayoutSetGetTopMargin(void);
+extern int UtcDaliNavigationLayoutSetGetBottomMargin(void);
+extern int UtcDaliNavigationLayoutSetGetScrollSpeedFactor(void);
+extern int UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed(void);
+extern int UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration(void);
+extern int UtcDaliNavigationLayoutGetScrollToPosition(void);
+extern int UtcDaliOverlayConstructor(void);
+extern int UtcDaliOverlayUninitializedEffect(void);
+extern int UtcDaliPageNew(void);
+extern int UtcDaliPageDownCast(void);
+extern int UtcDaliPageSetGetTitle(void);
+extern int UtcDaliPageSetGetSubTitle(void);
+extern int UtcDaliPageSetGetTitleIcon(void);
+extern int UtcDaliPageAddGetToolBarControl(void);
+extern int UtcDaliPageAddGetTitleBarControl(void);
+extern int UtcDaliPageSetGetPopupMenu(void);
+extern int UtcDaliPageTurnEffectApply(void);
+extern int UtcDaliPageTurnEffectConstruct(void);
+extern int UtcDaliPageTurnPortraitViewNew(void);
+extern int UtcDaliPageTurnLandscapeViewNew(void);
+extern int UtcDaliPageTurnViewSetAndGetSpineShadowParameter(void);
+extern int UtcDaliPageTurnViewGoToPageAndGetCurrentPage(void);
+extern int UtcDaliPageTurnViewEnterLeaveEditMode(void);
+extern int UtcDaliPageTurnViewGetHitActor(void);
+extern int UtcDaliPageTurnViewRefresh(void);
+extern int UtcDaliPageTurnViewSignals(void);
+extern int UtcDaliRollLayoutNew(void);
+extern int UtcDaliRollLayoutSetAndGetRowSpacing(void);
+extern int UtcDaliRollLayoutSetAndGetItemSizeFunction(void);
+extern int UtcDaliRollLayoutSetAndGetScrollSpeedFactor(void);
+extern int UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed(void);
+extern int UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration(void);
+extern int UtcDaliRollLayoutConstraintLeft(void);
+extern int UtcDaliRollLayoutConstraintRight(void);
+extern int UtcDaliRollLayoutConstraintUp(void);
+extern int UtcDaliRollLayoutConstraintDown(void);
+extern int UtcDaliRollLayoutScrollDirection(void);
+extern int UtcDaliRotatingSelectorNew(void);
+extern int UtcDaliRotatingSelectorSetSelected(void);
+extern int UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor(void);
+extern int UtcDaliRotatingSelectorSetSelectable(void);
+extern int UtcDaliRotatingSelectorSignalSelected(void);
+extern int UtcDaliScrollViewNew(void);
+extern int UtcDaliScrollViewDownCast(void);
+extern int UtcDaliScrollViewScrollToPosition(void);
+extern int UtcDaliScrollViewScrollToPage(void);
+extern int UtcDaliScrollViewScrollToActor(void);
+extern int UtcDaliScrollViewScrollToSnapPoint(void);
+extern int UtcDaliScrollViewRulerScale(void);
+extern int UtcDaliScrollViewTransformTo(void);
+extern int UtcDaliScrollViewRefreshInterval(void);
+extern int UtcDaliScrollViewWrapMode(void);
+extern int UtcDaliScrollViewActorAutoSnap(void);
+extern int UtcDaliScrollViewSignalsStartComplete(void);
+extern int UtcDaliScrollViewSignalsUpdate(void);
+extern int UtcDaliScrollViewSignalsClamped(void);
+extern int UtcDaliScrollViewScrollSensitive(void);
+extern int UtcDaliScrollViewTouchesRequired(void);
+extern int UtcDaliScrollViewAxisAutoLock(void);
+extern int UtcDaliScrollViewAxisAutoLockGradient(void);
+extern int UtcDaliScrollViewConstraints(void);
+extern int UtcDaliScrollViewBind(void);
+extern int UtcDaliRulerEnableDisable(void);
+extern int UtcDaliRulerDomainEnableDisable(void);
+extern int UtcDaliRulerSnapAndClamp(void);
+extern int UtcDaliRulerFixedRulerSpacing(void);
+extern int UtcDaliScrollViewOvershoot(void);
+extern int UtcDaliScrollViewSnapAlphaFunction(void);
+extern int UtcDaliScrollViewSnapDuration(void);
+extern int UtcDaliScrollViewSignalsSnapStart(void);
+extern int UtcDaliScrollViewSetMouseWheelScrollDistanceStep(void);
+extern int UtcDaliScrollViewGetSet(void);
+extern int UtcDaliShadowViewUninitialized(void);
+extern int UtcDaliShadowViewNew(void);
+extern int UtcDaliShadowViewDownCast(void);
+extern int UtcDaliShadowViewPropertyNames(void);
+extern int UtcDaliShadowViewAddRemove(void);
+extern int UtcDaliShadowViewActivateDeactivate(void);
+extern int UtcDaliShearEffectUninitialized(void);
+extern int UtcDaliShearEffectPropertyNames(void);
+extern int UtcDaliShearEffectDefaultValues(void);
+extern int UtcDaliShearEffectCustomValues(void);
+extern int UtcDaliSliderNew(void);
+extern int UtcDaliSliderDestructor(void);
+extern int UtcDaliSliderDownCast(void);
+extern int UtcDaliSliderSignals(void);
+extern int UtcDaliSoftButtonEffectUninitialized(void);
+extern int UtcDaliSoftButtonEffectNew(void);
+extern int UtcDaliSoftButtonEffectPropertyNames(void);
+extern int UtcDaliSpiralLayoutNew(void);
+extern int UtcDaliSpiralSetAndGetItemSizeFunction(void);
+extern int UtcDaliSpiralSetAndGetItemSpacing(void);
+extern int UtcDaliSpiralSetAndGetRevolutionDistance(void);
+extern int UtcDaliSpiralSetAndGetSpiralRadiusFunction(void);
+extern int UtcDaliSpiralSetAndGetTopItemAlignment(void);
+extern int UtcDaliSpiralSetAndGetScrollSpeedFactor(void);
+extern int UtcDaliSpiralSetAndGetMaximumSwipeSpeed(void);
+extern int UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration(void);
+extern int UtcDaliSpiralLayoutConstraintLeft(void);
+extern int UtcDaliSpiralLayoutConstraintRight(void);
+extern int UtcDaliSpiralLayoutConstraintUp(void);
+extern int UtcDaliSpiralLayoutConstraintDown(void);
+extern int UtcDaliSpiralLayoutScrollDirection(void);
+extern int UtcDaliSpiralLayoutGetScrollToPosition(void);
+extern int UtcDaliSpotUninitializedEffect(void);
+extern int UtcDaliSpotPropertyNamesEffect(void);
+extern int UtcDaliSpotDefaultValuesEffect(void);
+extern int UtcDaliSpotCustomValuesEffect(void);
+extern int UtcDaliSquareDissolveEffectUninitialized(void);
+extern int UtcDaliSquareDissolveEffectPropertyNames(void);
+extern int UtcDaliSquareDissolveEffectDefaultValues(void);
+extern int UtcDaliSquareDissolveEffectCustomValues(void);
+extern int UtcDaliTableViewNew(void);
+extern int UtcDaliTableViewMetricsPadding(void);
+extern int UtcDaliTableViewMetricsFixed(void);
+extern int UtcDaliTableViewMetricsRelative(void);
+extern int UtcDaliTableViewAnimation(void);
+extern int UtcDaliTableViewChild(void);
+extern int UtcDaliTableViewAdd(void);
+extern int UtcDaliTableViewCells(void);
+extern int UtcDaliTableViewChildAssert(void);
+extern int UtcDaliTableViewMetricsAssert(void);
+extern int UtcDaliToolBarNew(void);
+extern int UtcDaliToolBarSetBackground(void);
+extern int UtcDaliToolBarAddControl01(void);
+extern int UtcDaliToolBarAddControl02(void);
+extern int UtcDaliToolBarRemoveControl01(void);
+extern int UtcDaliToolBarRemoveControl02(void);
+extern int UtcDaliViewNew(void);
+extern int UtcDaliViewAddGetRemoveContentLayer01(void);
+extern int UtcDaliViewAddGetRemoveContentLayer02(void);
+extern int UtcDaliViewSetGetBackgroundLayer01(void);
+extern int UtcDaliViewSetGetBackgroundLayer02(void);
+extern int UtcDaliViewSetOrientationFunction(void);
+extern int UtcDaliViewOrientationChanged(void);
+extern int UtcSetAutoRotate(void);
+extern int UtcDaliWaterEffectUninitialized(void);
+extern int UtcDaliWaterEffectPropertyNames(void);
+extern int UtcDaliWaterEffectOutOfBounds(void);
+extern int UtcDaliWaterEffectDefaultValues(void);
+extern int UtcDaliWaterEffectCustomValues(void);
+extern int UtcDaliWaterEffectGetAmplitudePositive(void);
+extern int UtcDaliWaterEffectGetAmplitudeNegative(void);
+extern int UtcDaliWaterEffectGetCenterPositive(void);
+extern int UtcDaliWaterEffectGetCenterNegative(void);
+extern int UtcDaliWaterEffectGetPropagationPositive(void);
+extern int UtcDaliWaterEffectGetPropagationNegative(void);
+extern int UtcDaliButtonNew(void);
+extern int UtcDaliButtonProperties(void);
+extern int UtcDaliButtonSetGetDimmed(void);
+extern int UtcDaliControlImplTypeRegistry(void);
+extern int UtcDaliControlImplMouseWheelEvent(void);
+extern int UtcDaliDefaultControlsCreateCheckBoxButton(void);
+extern int UtcDaliItemViewAddAndGetLayout(void);
+extern int UtcDaliItemViewAddAndRemoveLayout(void);
+extern int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void);
+extern int UtcDaliKeyboardFocusManagerGet(void);
+extern int UtcDaliKeyboardFocusManagerMoveFocus(void);
+extern int UtcDaliKeyboardFocusManagerSignalFocusGroupChanged(void);
+extern int UtcDaliScrollViewPageCubeEffectSetup(void);
+extern int UtcDaliScrollViewPageCarouselEffectSetup(void);
+extern int UtcDaliScrollViewCarouselEffectSetup(void);
+extern int UtcDaliScrollViewDepthEffectSetup(void);
+extern int UtcDaliScrollViewPageCubeEffectTest(void);
+extern int UtcDaliScrollViewPageCarouselEffectTest(void);
+extern int UtcDaliScrollViewCarouselEffectTest(void);
+extern int UtcDaliScrollViewDepthEffectTest(void);
+extern int UtcDaliTextInputSetActiveStyle(void);
+extern int UtcDaliTextInputApplyStyleToSelectedText(void);
+extern int UtcDaliTextInputApplyStyleToAll(void);
+extern int UtcDaliTextInputGetStyleAtCursor(void);
+extern int UtcDaliTextInputSetAndGetTextAlignment(void);
+extern int UtcDaliTextInputSetAndGetMultilinePolicy(void);
+extern int UtcDaliTextInputSetAndGetExceedEnabled(void);
+
+testcase tc_array[] = {
+ {"UtcDaliAlbumLayoutNew", UtcDaliAlbumLayoutNew, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetAndGetItemSizeFunction", UtcDaliAlbumSetAndGetItemSizeFunction, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetAndGetScrollSpeedFactor", UtcDaliAlbumSetAndGetScrollSpeedFactor, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetAndGetMaximumSwipeSpeed", UtcDaliAlbumSetAndGetMaximumSwipeSpeed, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration", UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetNumOfItems", UtcDaliAlbumSetNumOfItems, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetStackNum", UtcDaliAlbumSetStackNum, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetPosition", UtcDaliAlbumSetPosition, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetRotationX", UtcDaliAlbumSetRotationX, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetRotationZ", UtcDaliAlbumSetRotationZ, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetScale", UtcDaliAlbumSetScale, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetColor", UtcDaliAlbumSetColor, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetCenterPosition", UtcDaliAlbumSetCenterPosition, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetSetCenterScale", UtcDaliAlbumSetSetCenterScale, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetSetCenterColor", UtcDaliAlbumSetSetCenterColor, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetStackPosition", UtcDaliAlbumSetStackPosition, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetSetStackScale", UtcDaliAlbumSetSetStackScale, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliAlbumSetStackColor", UtcDaliAlbumSetStackColor, album_layout_startup, album_layout_cleanup},
+ {"UtcDaliBendyUninitializedEffect", UtcDaliBendyUninitializedEffect, bendy_effect_startup, bendy_effect_cleanup},
+ {"UtcDaliBendyPropertyNamesEffect", UtcDaliBendyPropertyNamesEffect, bendy_effect_startup, bendy_effect_cleanup},
+ {"UtcDaliBendyDefaultValuesEffect", UtcDaliBendyDefaultValuesEffect, bendy_effect_startup, bendy_effect_cleanup},
+ {"UtcDaliBendyCustomValuesEffect", UtcDaliBendyCustomValuesEffect, bendy_effect_startup, bendy_effect_cleanup},
+ {"UtcDaliBlindEffectUninitialized", UtcDaliBlindEffectUninitialized, blind_effect_startup, blind_effect_cleanup},
+ {"UtcDaliBlindEffectPropertyNames", UtcDaliBlindEffectPropertyNames, blind_effect_startup, blind_effect_cleanup},
+ {"UtcDaliBlindEffectDefaultValues", UtcDaliBlindEffectDefaultValues, blind_effect_startup, blind_effect_cleanup},
+ {"UtcDaliBlindEffectCustomValues", UtcDaliBlindEffectCustomValues, blind_effect_startup, blind_effect_cleanup},
+ {"UtcDaliBloomViewUninitialized", UtcDaliBloomViewUninitialized, bloom_view_startup, bloom_view_cleanup},
+ {"UtcDaliBloomViewNew", UtcDaliBloomViewNew, bloom_view_startup, bloom_view_cleanup},
+ {"UtcDaliBloomViewDownCast", UtcDaliBloomViewDownCast, bloom_view_startup, bloom_view_cleanup},
+ {"UtcDaliBloomViewPropertyNames", UtcDaliBloomViewPropertyNames, bloom_view_startup, bloom_view_cleanup},
+ {"UtcDaliBloomViewAddRemove", UtcDaliBloomViewAddRemove, bloom_view_startup, bloom_view_cleanup},
+ {"UtcDaliBloomActivateDeactivate", UtcDaliBloomActivateDeactivate, bloom_view_startup, bloom_view_cleanup},
+ {"UtcDaliBuilderTextActorCreateFromStyle", UtcDaliBuilderTextActorCreateFromStyle, builder_startup, builder_cleanup},
+ {"UtcDaliBuilderTextActorCreateAnimation", UtcDaliBuilderTextActorCreateAnimation, builder_startup, builder_cleanup},
+ {"UtcDaliBuilderTextActorApplyFromStyle", UtcDaliBuilderTextActorApplyFromStyle, builder_startup, builder_cleanup},
+ {"UtcDaliBuilderAddActors", UtcDaliBuilderAddActors, builder_startup, builder_cleanup},
+ {"UtcDaliBuilderAddActorsOther", UtcDaliBuilderAddActorsOther, builder_startup, builder_cleanup},
+ {"UtcDaliBuilderStyles", UtcDaliBuilderStyles, builder_startup, builder_cleanup},
+ {"UtcDaliBuilderSetProperty", UtcDaliBuilderSetProperty, builder_startup, builder_cleanup},
+ {"UtcDaliCarouselEffectUninitialized", UtcDaliCarouselEffectUninitialized, carousel_effect_startup, carousel_effect_cleanup},
+ {"UtcDaliCarouselEffectPropertyNames", UtcDaliCarouselEffectPropertyNames, carousel_effect_startup, carousel_effect_cleanup},
+ {"UtcDaliCarouselEffectDefaultValues", UtcDaliCarouselEffectDefaultValues, carousel_effect_startup, carousel_effect_cleanup},
+ {"UtcDaliCarouselEffectCustomValues", UtcDaliCarouselEffectCustomValues, carousel_effect_startup, carousel_effect_cleanup},
+ {"UtcDaliCheckBoxButtonSetGetChecked", UtcDaliCheckBoxButtonSetGetChecked, checkbox_button_startup, checkbox_button_cleanup},
+ {"UtcDaliCheckBoxButtonSetImages", UtcDaliCheckBoxButtonSetImages, checkbox_button_startup, checkbox_button_cleanup},
+ {"UtcDaliClusterNew", UtcDaliClusterNew, cluster_startup, cluster_cleanup},
+ {"UtcDaliClusterDownCast", UtcDaliClusterDownCast, cluster_startup, cluster_cleanup},
+ {"UtcDaliClusterAddAndRemoveChild", UtcDaliClusterAddAndRemoveChild, cluster_startup, cluster_cleanup},
+ {"UtcDaliClusterExpandAndCollapseChild", UtcDaliClusterExpandAndCollapseChild, cluster_startup, cluster_cleanup},
+ {"UtcDaliClusterSetAndGetStyle", UtcDaliClusterSetAndGetStyle, cluster_startup, cluster_cleanup},
+ {"UtcDaliCubeTransitionWaveEffectNew", UtcDaliCubeTransitionWaveEffectNew, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionCrossEffectNew", UtcDaliCubeTransitionCrossEffectNew, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionFoldEffectNew", UtcDaliCubeTransitionFoldEffectNew, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionEffectSetGetTransitionDuration", UtcDaliCubeTransitionEffectSetGetTransitionDuration, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionEffectSetGetCubeDisplacement", UtcDaliCubeTransitionEffectSetGetCubeDisplacement, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionEffectGetRoot", UtcDaliCubeTransitionEffectGetRoot, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionEffectIsTransiting", UtcDaliCubeTransitionEffectIsTransiting, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionEffectSetCurrentImage", UtcDaliCubeTransitionEffectSetCurrentImage, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionEffectSetTargetImage", UtcDaliCubeTransitionEffectSetTargetImage, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionWaveEffectStartTransition", UtcDaliCubeTransitionWaveEffectStartTransition, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionCrossEffectStartTransition", UtcDaliCubeTransitionCrossEffectStartTransition, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionFoldEffectStartTransition", UtcDaliCubeTransitionFoldEffectStartTransition, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionEffectSignalTransitionCompleted", UtcDaliCubeTransitionEffectSignalTransitionCompleted, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionEffectPauseResumeTransition", UtcDaliCubeTransitionEffectPauseResumeTransition, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionWaveEffectStopTransition", UtcDaliCubeTransitionWaveEffectStopTransition, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionCrossEffectStopTransition", UtcDaliCubeTransitionCrossEffectStopTransition, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliCubeTransitionFoldEffectStopTransition", UtcDaliCubeTransitionFoldEffectStopTransition, cube_transition_effect_startup, cube_transition_effect_cleanup},
+ {"UtcDaliDepthLayoutNew", UtcDaliDepthLayoutNew, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetNumberOfColumns", UtcDaliDepthLayoutSetAndGetNumberOfColumns, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetNumberOfRows", UtcDaliDepthLayoutSetAndGetNumberOfRows, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetRowSpacing", UtcDaliDepthLayoutSetAndGetRowSpacing, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetTiltAngle", UtcDaliDepthLayoutSetAndGetTiltAngle, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetItemSizeFunction", UtcDaliDepthLayoutSetAndGetItemSizeFunction, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetBottomMarginFunction", UtcDaliDepthLayoutSetAndGetBottomMarginFunction, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetItemTiltAngle", UtcDaliDepthLayoutSetAndGetItemTiltAngle, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetColumnPositionFunction", UtcDaliDepthLayoutSetAndGetColumnPositionFunction, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetScrollSpeedFactor", UtcDaliDepthLayoutSetAndGetScrollSpeedFactor, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed", UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration", UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutConstraintLeft", UtcDaliDepthLayoutConstraintLeft, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutConstraintRight", UtcDaliDepthLayoutConstraintRight, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutConstraintUp", UtcDaliDepthLayoutConstraintUp, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutConstraintDown", UtcDaliDepthLayoutConstraintDown, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutGetScrollToPosition", UtcDaliDepthLayoutGetScrollToPosition, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDepthLayoutScrollDirection", UtcDaliDepthLayoutScrollDirection, depth_layout_startup, depth_layout_cleanup},
+ {"UtcDaliDisplacementEffectUninitialized", UtcDaliDisplacementEffectUninitialized, utc_displacement_startup, utc_displacement_cleanup},
+ {"UtcDaliDisplacementEffectNew", UtcDaliDisplacementEffectNew, utc_displacement_startup, utc_displacement_cleanup},
+ {"UtcDaliDisplacementEffectPropertyNames", UtcDaliDisplacementEffectPropertyNames, utc_displacement_startup, utc_displacement_cleanup},
+ {"UtcDaliDisplacementEffectTestSetProperty", UtcDaliDisplacementEffectTestSetProperty, utc_displacement_startup, utc_displacement_cleanup},
+ {"UtcDaliDistanceFieldEffectUninitialized", UtcDaliDistanceFieldEffectUninitialized, utc_distance_field_effect_startup, utc_distance_field_effect_cleanup},
+ {"UtcDaliDistanceFieldEffectPropertyNames", UtcDaliDistanceFieldEffectPropertyNames, utc_distance_field_effect_startup, utc_distance_field_effect_cleanup},
+ {"UtcDaliDistanceFieldEffectDefaultValues", UtcDaliDistanceFieldEffectDefaultValues, utc_distance_field_effect_startup, utc_distance_field_effect_cleanup},
+ {"UtcDaliDistanceFieldEffectCustomValues", UtcDaliDistanceFieldEffectCustomValues, utc_distance_field_effect_startup, utc_distance_field_effect_cleanup},
+ {"UtcDaliGaussianBlurViewUninitialized", UtcDaliGaussianBlurViewUninitialized, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup},
+ {"UtcDaliGaussianBlurViewNew", UtcDaliGaussianBlurViewNew, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup},
+ {"UtcDaliGaussianBlurViewDownCast", UtcDaliGaussianBlurViewDownCast, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup},
+ {"UtcDaliGaussianBlurViewPropertyNames", UtcDaliGaussianBlurViewPropertyNames, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup},
+ {"UtcDaliGaussianBlurViewAddRemove", UtcDaliGaussianBlurViewAddRemove, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup},
+ {"UtcDaliGaussianBlurActivateDeactivate", UtcDaliGaussianBlurActivateDeactivate, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup},
+ {"UtcDaliGaussianBlurViewSetGetBackgroundColor", UtcDaliGaussianBlurViewSetGetBackgroundColor, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup},
+ {"UtcDaliGaussianBlurViewSetGetRenderTarget", UtcDaliGaussianBlurViewSetGetRenderTarget, utc_gaussian_blur_view_startup, utc_gaussian_blur_view_cleanup},
+ {"UtcDaliJsonParserMethod01", UtcDaliJsonParserMethod01, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod02", UtcDaliJsonParserMethod02, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod03", UtcDaliJsonParserMethod03, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod04", UtcDaliJsonParserMethod04, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod05", UtcDaliJsonParserMethod05, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod06", UtcDaliJsonParserMethod06, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod07", UtcDaliJsonParserMethod07, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod08", UtcDaliJsonParserMethod08, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod09", UtcDaliJsonParserMethod09, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliJsonParserMethod10", UtcDaliJsonParserMethod10, utc_json_parser_startup, utc_json_parser_cleanup},
+ {"UtcDaliKeyInputFocusManagerGet", UtcDaliKeyInputFocusManagerGet, key_input_focus_manager_startup, key_input_focus_manager_cleanup},
+ {"UtcDaliKeyInputFocusManagerSetFocus", UtcDaliKeyInputFocusManagerSetFocus, key_input_focus_manager_startup, key_input_focus_manager_cleanup},
+ {"UtcDaliKeyInputFocusManagerGetCurrentFocusControl", UtcDaliKeyInputFocusManagerGetCurrentFocusControl, key_input_focus_manager_startup, key_input_focus_manager_cleanup},
+ {"UtcDaliKeyInputFocusManagerRemoveFocus", UtcDaliKeyInputFocusManagerRemoveFocus, key_input_focus_manager_startup, key_input_focus_manager_cleanup},
+ {"UtcDaliKeyInputFocusManagerIsKeyboardListener", UtcDaliKeyInputFocusManagerIsKeyboardListener, key_input_focus_manager_startup, key_input_focus_manager_cleanup},
+ {"UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged", UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged, key_input_focus_manager_startup, key_input_focus_manager_cleanup},
+ {"UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent", UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent, key_input_focus_manager_startup, key_input_focus_manager_cleanup},
+ {"UtcDaliNavigationControlNew", UtcDaliNavigationControlNew, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlDownCast", UtcDaliNavigationControlDownCast, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlPushItem", UtcDaliNavigationControlPushItem, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlPopItem", UtcDaliNavigationControlPopItem, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlGetItemCount", UtcDaliNavigationControlGetItemCount, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlGetItem", UtcDaliNavigationControlGetItem, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlGetCurrentItem", UtcDaliNavigationControlGetCurrentItem, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlSetBackground", UtcDaliNavigationControlSetBackground, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlCreateNavigationToolBar", UtcDaliNavigationControlCreateNavigationToolBar, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationControlCreateNavigationTitleBar", UtcDaliNavigationControlCreateNavigationTitleBar, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutNew", UtcDaliNavigationLayoutNew, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutColumns", UtcDaliNavigationLayoutColumns, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutSetGetOrientation", UtcDaliNavigationLayoutSetGetOrientation, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutTestConstraintLeft", UtcDaliNavigationLayoutTestConstraintLeft, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutTestConstraintRight", UtcDaliNavigationLayoutTestConstraintRight, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutTestConstraintUp", UtcDaliNavigationLayoutTestConstraintUp, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutTestConstraintDown", UtcDaliNavigationLayoutTestConstraintDown, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutScrollDirection", UtcDaliNavigationLayoutScrollDirection, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutSetGetColumnSpacing", UtcDaliNavigationLayoutSetGetColumnSpacing, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutSetGetTopMargin", UtcDaliNavigationLayoutSetGetTopMargin, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutSetGetBottomMargin", UtcDaliNavigationLayoutSetGetBottomMargin, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutSetGetScrollSpeedFactor", UtcDaliNavigationLayoutSetGetScrollSpeedFactor, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed", UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration", UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliNavigationLayoutGetScrollToPosition", UtcDaliNavigationLayoutGetScrollToPosition, navigation_control_startup, navigation_control_cleanup},
+ {"UtcDaliOverlayConstructor", UtcDaliOverlayConstructor, overlay_effect_startup, overlay_effect_cleanup},
+ {"UtcDaliOverlayUninitializedEffect", UtcDaliOverlayUninitializedEffect, overlay_effect_startup, overlay_effect_cleanup},
+ {"UtcDaliPageNew", UtcDaliPageNew, dali_page_startup, dali_page_cleanup},
+ {"UtcDaliPageDownCast", UtcDaliPageDownCast, dali_page_startup, dali_page_cleanup},
+ {"UtcDaliPageSetGetTitle", UtcDaliPageSetGetTitle, dali_page_startup, dali_page_cleanup},
+ {"UtcDaliPageSetGetSubTitle", UtcDaliPageSetGetSubTitle, dali_page_startup, dali_page_cleanup},
+ {"UtcDaliPageSetGetTitleIcon", UtcDaliPageSetGetTitleIcon, dali_page_startup, dali_page_cleanup},
+ {"UtcDaliPageAddGetToolBarControl", UtcDaliPageAddGetToolBarControl, dali_page_startup, dali_page_cleanup},
+ {"UtcDaliPageAddGetTitleBarControl", UtcDaliPageAddGetTitleBarControl, dali_page_startup, dali_page_cleanup},
+ {"UtcDaliPageSetGetPopupMenu", UtcDaliPageSetGetPopupMenu, dali_page_startup, dali_page_cleanup},
+ {"UtcDaliPageTurnEffectApply", UtcDaliPageTurnEffectApply, page_turn_effect_startup, page_turn_effect_cleanup},
+ {"UtcDaliPageTurnEffectConstruct", UtcDaliPageTurnEffectConstruct, page_turn_effect_startup, page_turn_effect_cleanup},
+ {"UtcDaliPageTurnPortraitViewNew", UtcDaliPageTurnPortraitViewNew, dali_page_turn_view_startup, dali_page_turn_view_cleanup},
+ {"UtcDaliPageTurnLandscapeViewNew", UtcDaliPageTurnLandscapeViewNew, dali_page_turn_view_startup, dali_page_turn_view_cleanup},
+ {"UtcDaliPageTurnViewSetAndGetSpineShadowParameter", UtcDaliPageTurnViewSetAndGetSpineShadowParameter, dali_page_turn_view_startup, dali_page_turn_view_cleanup},
+ {"UtcDaliPageTurnViewGoToPageAndGetCurrentPage", UtcDaliPageTurnViewGoToPageAndGetCurrentPage, dali_page_turn_view_startup, dali_page_turn_view_cleanup},
+ {"UtcDaliPageTurnViewEnterLeaveEditMode", UtcDaliPageTurnViewEnterLeaveEditMode, dali_page_turn_view_startup, dali_page_turn_view_cleanup},
+ {"UtcDaliPageTurnViewGetHitActor", UtcDaliPageTurnViewGetHitActor, dali_page_turn_view_startup, dali_page_turn_view_cleanup},
+ {"UtcDaliPageTurnViewRefresh", UtcDaliPageTurnViewRefresh, dali_page_turn_view_startup, dali_page_turn_view_cleanup},
+ {"UtcDaliPageTurnViewSignals", UtcDaliPageTurnViewSignals, dali_page_turn_view_startup, dali_page_turn_view_cleanup},
+ {"UtcDaliRollLayoutNew", UtcDaliRollLayoutNew, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutSetAndGetRowSpacing", UtcDaliRollLayoutSetAndGetRowSpacing, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutSetAndGetItemSizeFunction", UtcDaliRollLayoutSetAndGetItemSizeFunction, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutSetAndGetScrollSpeedFactor", UtcDaliRollLayoutSetAndGetScrollSpeedFactor, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed", UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration", UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutConstraintLeft", UtcDaliRollLayoutConstraintLeft, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutConstraintRight", UtcDaliRollLayoutConstraintRight, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutConstraintUp", UtcDaliRollLayoutConstraintUp, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutConstraintDown", UtcDaliRollLayoutConstraintDown, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRollLayoutScrollDirection", UtcDaliRollLayoutScrollDirection, dali_roll_layout_startup, dali_roll_layout_cleanup},
+ {"UtcDaliRotatingSelectorNew", UtcDaliRotatingSelectorNew, rotating_selector_startup, rotating_selector_cleanup},
+ {"UtcDaliRotatingSelectorSetSelected", UtcDaliRotatingSelectorSetSelected, rotating_selector_startup, rotating_selector_cleanup},
+ {"UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor", UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor, rotating_selector_startup, rotating_selector_cleanup},
+ {"UtcDaliRotatingSelectorSetSelectable", UtcDaliRotatingSelectorSetSelectable, rotating_selector_startup, rotating_selector_cleanup},
+ {"UtcDaliRotatingSelectorSignalSelected", UtcDaliRotatingSelectorSignalSelected, rotating_selector_startup, rotating_selector_cleanup},
+ {"UtcDaliScrollViewNew", UtcDaliScrollViewNew, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewDownCast", UtcDaliScrollViewDownCast, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewScrollToPosition", UtcDaliScrollViewScrollToPosition, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewScrollToPage", UtcDaliScrollViewScrollToPage, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewScrollToActor", UtcDaliScrollViewScrollToActor, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewScrollToSnapPoint", UtcDaliScrollViewScrollToSnapPoint, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewRulerScale", UtcDaliScrollViewRulerScale, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewTransformTo", UtcDaliScrollViewTransformTo, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewRefreshInterval", UtcDaliScrollViewRefreshInterval, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewWrapMode", UtcDaliScrollViewWrapMode, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewActorAutoSnap", UtcDaliScrollViewActorAutoSnap, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewSignalsStartComplete", UtcDaliScrollViewSignalsStartComplete, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewSignalsUpdate", UtcDaliScrollViewSignalsUpdate, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewSignalsClamped", UtcDaliScrollViewSignalsClamped, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewScrollSensitive", UtcDaliScrollViewScrollSensitive, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewTouchesRequired", UtcDaliScrollViewTouchesRequired, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewAxisAutoLock", UtcDaliScrollViewAxisAutoLock, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewAxisAutoLockGradient", UtcDaliScrollViewAxisAutoLockGradient, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewConstraints", UtcDaliScrollViewConstraints, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewBind", UtcDaliScrollViewBind, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliRulerEnableDisable", UtcDaliRulerEnableDisable, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliRulerDomainEnableDisable", UtcDaliRulerDomainEnableDisable, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliRulerSnapAndClamp", UtcDaliRulerSnapAndClamp, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliRulerFixedRulerSpacing", UtcDaliRulerFixedRulerSpacing, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewOvershoot", UtcDaliScrollViewOvershoot, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewSnapAlphaFunction", UtcDaliScrollViewSnapAlphaFunction, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewSnapDuration", UtcDaliScrollViewSnapDuration, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewSignalsSnapStart", UtcDaliScrollViewSignalsSnapStart, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewSetMouseWheelScrollDistanceStep", UtcDaliScrollViewSetMouseWheelScrollDistanceStep, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliScrollViewGetSet", UtcDaliScrollViewGetSet, scroll_view_startup, scroll_view_cleanup},
+ {"UtcDaliShadowViewUninitialized", UtcDaliShadowViewUninitialized, shadow_view_startup, shadow_view_cleanup},
+ {"UtcDaliShadowViewNew", UtcDaliShadowViewNew, shadow_view_startup, shadow_view_cleanup},
+ {"UtcDaliShadowViewDownCast", UtcDaliShadowViewDownCast, shadow_view_startup, shadow_view_cleanup},
+ {"UtcDaliShadowViewPropertyNames", UtcDaliShadowViewPropertyNames, shadow_view_startup, shadow_view_cleanup},
+ {"UtcDaliShadowViewAddRemove", UtcDaliShadowViewAddRemove, shadow_view_startup, shadow_view_cleanup},
+ {"UtcDaliShadowViewActivateDeactivate", UtcDaliShadowViewActivateDeactivate, shadow_view_startup, shadow_view_cleanup},
+ {"UtcDaliShearEffectUninitialized", UtcDaliShearEffectUninitialized, shear_effect_startup, shear_effect_cleanup},
+ {"UtcDaliShearEffectPropertyNames", UtcDaliShearEffectPropertyNames, shear_effect_startup, shear_effect_cleanup},
+ {"UtcDaliShearEffectDefaultValues", UtcDaliShearEffectDefaultValues, shear_effect_startup, shear_effect_cleanup},
+ {"UtcDaliShearEffectCustomValues", UtcDaliShearEffectCustomValues, shear_effect_startup, shear_effect_cleanup},
+ {"UtcDaliSliderNew", UtcDaliSliderNew, dali_slider_startup, dali_slider_cleanup},
+ {"UtcDaliSliderDestructor", UtcDaliSliderDestructor, dali_slider_startup, dali_slider_cleanup},
+ {"UtcDaliSliderDownCast", UtcDaliSliderDownCast, dali_slider_startup, dali_slider_cleanup},
+ {"UtcDaliSliderSignals", UtcDaliSliderSignals, dali_slider_startup, dali_slider_cleanup},
+ {"UtcDaliSoftButtonEffectUninitialized", UtcDaliSoftButtonEffectUninitialized, soft_button_effect_startup, soft_button_effect_cleanup},
+ {"UtcDaliSoftButtonEffectNew", UtcDaliSoftButtonEffectNew, soft_button_effect_startup, soft_button_effect_cleanup},
+ {"UtcDaliSoftButtonEffectPropertyNames", UtcDaliSoftButtonEffectPropertyNames, soft_button_effect_startup, soft_button_effect_cleanup},
+ {"UtcDaliSpiralLayoutNew", UtcDaliSpiralLayoutNew, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralSetAndGetItemSizeFunction", UtcDaliSpiralSetAndGetItemSizeFunction, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralSetAndGetItemSpacing", UtcDaliSpiralSetAndGetItemSpacing, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralSetAndGetRevolutionDistance", UtcDaliSpiralSetAndGetRevolutionDistance, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralSetAndGetSpiralRadiusFunction", UtcDaliSpiralSetAndGetSpiralRadiusFunction, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralSetAndGetTopItemAlignment", UtcDaliSpiralSetAndGetTopItemAlignment, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralSetAndGetScrollSpeedFactor", UtcDaliSpiralSetAndGetScrollSpeedFactor, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralSetAndGetMaximumSwipeSpeed", UtcDaliSpiralSetAndGetMaximumSwipeSpeed, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration", UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralLayoutConstraintLeft", UtcDaliSpiralLayoutConstraintLeft, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralLayoutConstraintRight", UtcDaliSpiralLayoutConstraintRight, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralLayoutConstraintUp", UtcDaliSpiralLayoutConstraintUp, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralLayoutConstraintDown", UtcDaliSpiralLayoutConstraintDown, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralLayoutScrollDirection", UtcDaliSpiralLayoutScrollDirection, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpiralLayoutGetScrollToPosition", UtcDaliSpiralLayoutGetScrollToPosition, spiral_layout_startup, spiral_layout_cleanup},
+ {"UtcDaliSpotUninitializedEffect", UtcDaliSpotUninitializedEffect, spot_effect_startup, spot_effect_cleanup},
+ {"UtcDaliSpotPropertyNamesEffect", UtcDaliSpotPropertyNamesEffect, spot_effect_startup, spot_effect_cleanup},
+ {"UtcDaliSpotDefaultValuesEffect", UtcDaliSpotDefaultValuesEffect, spot_effect_startup, spot_effect_cleanup},
+ {"UtcDaliSpotCustomValuesEffect", UtcDaliSpotCustomValuesEffect, spot_effect_startup, spot_effect_cleanup},
+ {"UtcDaliSquareDissolveEffectUninitialized", UtcDaliSquareDissolveEffectUninitialized, square_dissolve_effect_startup, square_dissolve_effect_cleanup},
+ {"UtcDaliSquareDissolveEffectPropertyNames", UtcDaliSquareDissolveEffectPropertyNames, square_dissolve_effect_startup, square_dissolve_effect_cleanup},
+ {"UtcDaliSquareDissolveEffectDefaultValues", UtcDaliSquareDissolveEffectDefaultValues, square_dissolve_effect_startup, square_dissolve_effect_cleanup},
+ {"UtcDaliSquareDissolveEffectCustomValues", UtcDaliSquareDissolveEffectCustomValues, square_dissolve_effect_startup, square_dissolve_effect_cleanup},
+ {"UtcDaliTableViewNew", UtcDaliTableViewNew, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewMetricsPadding", UtcDaliTableViewMetricsPadding, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewMetricsFixed", UtcDaliTableViewMetricsFixed, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewMetricsRelative", UtcDaliTableViewMetricsRelative, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewAnimation", UtcDaliTableViewAnimation, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewChild", UtcDaliTableViewChild, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewAdd", UtcDaliTableViewAdd, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewCells", UtcDaliTableViewCells, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewChildAssert", UtcDaliTableViewChildAssert, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliTableViewMetricsAssert", UtcDaliTableViewMetricsAssert, dali_tableview_startup, dali_tableview_cleanup},
+ {"UtcDaliToolBarNew", UtcDaliToolBarNew, dali_toolbar_startup, dali_toolbar_cleanup},
+ {"UtcDaliToolBarSetBackground", UtcDaliToolBarSetBackground, dali_toolbar_startup, dali_toolbar_cleanup},
+ {"UtcDaliToolBarAddControl01", UtcDaliToolBarAddControl01, dali_toolbar_startup, dali_toolbar_cleanup},
+ {"UtcDaliToolBarAddControl02", UtcDaliToolBarAddControl02, dali_toolbar_startup, dali_toolbar_cleanup},
+ {"UtcDaliToolBarRemoveControl01", UtcDaliToolBarRemoveControl01, dali_toolbar_startup, dali_toolbar_cleanup},
+ {"UtcDaliToolBarRemoveControl02", UtcDaliToolBarRemoveControl02, dali_toolbar_startup, dali_toolbar_cleanup},
+ {"UtcDaliViewNew", UtcDaliViewNew, dali_view_startup, dali_view_cleanup},
+ {"UtcDaliViewAddGetRemoveContentLayer01", UtcDaliViewAddGetRemoveContentLayer01, dali_view_startup, dali_view_cleanup},
+ {"UtcDaliViewAddGetRemoveContentLayer02", UtcDaliViewAddGetRemoveContentLayer02, dali_view_startup, dali_view_cleanup},
+ {"UtcDaliViewSetGetBackgroundLayer01", UtcDaliViewSetGetBackgroundLayer01, dali_view_startup, dali_view_cleanup},
+ {"UtcDaliViewSetGetBackgroundLayer02", UtcDaliViewSetGetBackgroundLayer02, dali_view_startup, dali_view_cleanup},
+ {"UtcDaliViewSetOrientationFunction", UtcDaliViewSetOrientationFunction, dali_view_startup, dali_view_cleanup},
+ {"UtcDaliViewOrientationChanged", UtcDaliViewOrientationChanged, dali_view_startup, dali_view_cleanup},
+ {"UtcSetAutoRotate", UtcSetAutoRotate, dali_view_startup, dali_view_cleanup},
+ {"UtcDaliWaterEffectUninitialized", UtcDaliWaterEffectUninitialized, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectPropertyNames", UtcDaliWaterEffectPropertyNames, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectOutOfBounds", UtcDaliWaterEffectOutOfBounds, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectDefaultValues", UtcDaliWaterEffectDefaultValues, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectCustomValues", UtcDaliWaterEffectCustomValues, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectGetAmplitudePositive", UtcDaliWaterEffectGetAmplitudePositive, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectGetAmplitudeNegative", UtcDaliWaterEffectGetAmplitudeNegative, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectGetCenterPositive", UtcDaliWaterEffectGetCenterPositive, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectGetCenterNegative", UtcDaliWaterEffectGetCenterNegative, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectGetPropagationPositive", UtcDaliWaterEffectGetPropagationPositive, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliWaterEffectGetPropagationNegative", UtcDaliWaterEffectGetPropagationNegative, dali_water_effect_startup, dali_water_effect_cleanup},
+ {"UtcDaliButtonNew", UtcDaliButtonNew, dali_button_startup, dali_button_cleanup},
+ {"UtcDaliButtonProperties", UtcDaliButtonProperties, dali_button_startup, dali_button_cleanup},
+ {"UtcDaliButtonSetGetDimmed", UtcDaliButtonSetGetDimmed, dali_button_startup, dali_button_cleanup},
+ {"UtcDaliControlImplTypeRegistry", UtcDaliControlImplTypeRegistry, control_impl_startup, control_impl_cleanup},
+ {"UtcDaliControlImplMouseWheelEvent", UtcDaliControlImplMouseWheelEvent, control_impl_startup, control_impl_cleanup},
+ {"UtcDaliDefaultControlsCreateCheckBoxButton", UtcDaliDefaultControlsCreateCheckBoxButton, dali_default_controls_startup, dali_default_controls_cleanup},
+ {"UtcDaliItemViewAddAndGetLayout", UtcDaliItemViewAddAndGetLayout, dali_default_controls_startup, dali_default_controls_cleanup},
+ {"UtcDaliItemViewAddAndRemoveLayout", UtcDaliItemViewAddAndRemoveLayout, dali_default_controls_startup, dali_default_controls_cleanup},
+ {"UtcDaliItemViewActivateLayoutAndGetActiveLayout", UtcDaliItemViewActivateLayoutAndGetActiveLayout, dali_default_controls_startup, dali_default_controls_cleanup},
+ {"UtcDaliKeyboardFocusManagerGet", UtcDaliKeyboardFocusManagerGet, dali_keyboard_focus_manager_startup, dali_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerMoveFocus", UtcDaliKeyboardFocusManagerMoveFocus, dali_keyboard_focus_manager_startup, dali_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerSignalFocusGroupChanged", UtcDaliKeyboardFocusManagerSignalFocusGroupChanged, dali_keyboard_focus_manager_startup, dali_keyboard_focus_manager_cleanup},
+ {"UtcDaliScrollViewPageCubeEffectSetup", UtcDaliScrollViewPageCubeEffectSetup, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewPageCarouselEffectSetup", UtcDaliScrollViewPageCarouselEffectSetup, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewCarouselEffectSetup", UtcDaliScrollViewCarouselEffectSetup, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewDepthEffectSetup", UtcDaliScrollViewDepthEffectSetup, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewPageCubeEffectTest", UtcDaliScrollViewPageCubeEffectTest, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewPageCarouselEffectTest", UtcDaliScrollViewPageCarouselEffectTest, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewCarouselEffectTest", UtcDaliScrollViewCarouselEffectTest, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewDepthEffectTest", UtcDaliScrollViewDepthEffectTest, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliTextInputSetActiveStyle", UtcDaliTextInputSetActiveStyle, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliTextInputApplyStyleToSelectedText", UtcDaliTextInputApplyStyleToSelectedText, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliTextInputApplyStyleToAll", UtcDaliTextInputApplyStyleToAll, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliTextInputGetStyleAtCursor", UtcDaliTextInputGetStyleAtCursor, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliTextInputSetAndGetTextAlignment", UtcDaliTextInputSetAndGetTextAlignment, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliTextInputSetAndGetMultilinePolicy", UtcDaliTextInputSetAndGetMultilinePolicy, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {"UtcDaliTextInputSetAndGetExceedEnabled", UtcDaliTextInputSetAndGetExceedEnabled, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_DALI_TOOLKIT_UNMANAGED_CORE_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+using namespace Toolkit;
+
+using namespace std;
+
+
+namespace
+{
+
+Vector3 AlbumLayoutItemSizeFunction(const Vector3& layoutSize)
+{
+ float width = layoutSize.width * 0.2f;
+ return Vector3(width, width, width);
+}
+
+float AlbumLayoutAlbumRadiusFunction(const Vector3& layoutSize)
+{
+ return layoutSize.width * 0.5f;
+}
+} // namespace
+
+
+void album_layout_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void album_layout_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliAlbumLayoutNew(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ DALI_TEST_CHECK(albumLayout);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetAndGetItemSizeFunction(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ // Set the item size function
+ albumLayout->SetItemSizeFunction(AlbumLayoutItemSizeFunction);
+
+ // Check whether we get the correct item size function
+ DALI_TEST_CHECK(albumLayout->GetItemSizeFunction() == AlbumLayoutItemSizeFunction);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetAndGetScrollSpeedFactor(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ // Set the scroll speed factor
+ albumLayout->SetScrollSpeedFactor(0.05f);
+
+ // Check whether we get the correct scroll speed factor
+ DALI_TEST_EQUALS( albumLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAlbumSetAndGetMaximumSwipeSpeed(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ // Set the maximum swipe speed
+ albumLayout->SetMaximumSwipeSpeed(50.0f);
+
+ // Check whether we get the correct maximum swipe speed
+ DALI_TEST_EQUALS( albumLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ // Set the flick animaiton duration
+ albumLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( albumLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAlbumSetNumOfItems(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetNumOfItems(15);
+
+ DALI_TEST_CHECK(albumLayout->GetNumOfItems() == 15);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetStackNum(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetStackNum(30);
+
+ DALI_TEST_CHECK(albumLayout->GetStackNum() == 30);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetPosition(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ std::vector<Vector3> position_list;
+
+ /*(0.0f)*/
+ Vector3 pos = Vector3(850.0f,-250.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(1.0f)*/
+ pos = Vector3(700.0f,50.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(2.0f)*/
+ pos = Vector3(440.0f,227.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(4.0f)*/
+ pos = Vector3(-440.0f,227.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(5.0f)*/
+ pos = Vector3(-700.0f,50.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(6.0f)*/
+ pos = Vector3(-850.0f,-250.0f,0.0);
+ position_list.push_back(pos);
+
+ albumLayout->SetPosition(position_list);
+
+ DALI_TEST_CHECK(albumLayout->GetPosition() == position_list);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetRotationX(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetRotationX(Math::PI/4.0f);
+
+ DALI_TEST_CHECK(albumLayout->GetRotationX() == Math::PI/4.0f);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetRotationZ(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ std::vector<float> rotation_list;
+
+ /*(0.0f)*/
+ float rotate = Math::PI/6.0f;
+ rotation_list.push_back(rotate);
+
+ /*(1.0f)*/
+ rotate = 0.0f;
+ rotation_list.push_back(rotate);
+
+ /*(2.0f)*/
+ rotate = Math::PI/6.0f;
+ rotation_list.push_back(rotate);
+
+ /*(4.0f)*/
+ rotate = -Math::PI/6.0f;
+ rotation_list.push_back(rotate);
+
+ /*(5.0f)*/
+ rotate = 0.0f;
+ rotation_list.push_back(rotate);
+
+ /*(6.0f)*/
+ rotate = -Math::PI/6.0f;
+ rotation_list.push_back(rotate);
+
+ albumLayout->SetRotationZ(rotation_list);
+
+ DALI_TEST_CHECK(albumLayout->GetRotationZ() == rotation_list);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetScale(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ std::vector<float> scale_list;
+
+ /*(0.0f)*/
+ float scale = 1.0f;
+ scale_list.push_back(scale);
+
+ /*(1.0f)*/
+ scale = 0.0f;
+ scale_list.push_back(scale);
+
+ /*(2.0f)*/
+ scale = Math::PI/6.0f;
+ scale_list.push_back(scale);
+
+ /*(4.0f)*/
+ scale = -Math::PI/6.0f;
+ scale_list.push_back(scale);
+
+ /*(5.0f)*/
+ scale = 0.0f;
+ scale_list.push_back(scale);
+
+ /*(6.0f)*/
+ scale = -Math::PI/6.0f;
+ scale_list.push_back(scale);
+
+ albumLayout->SetScale(scale_list);
+
+ DALI_TEST_CHECK(albumLayout->GetScale() == scale_list);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetColor(void)
+{
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ std::vector<Vector2> color_list;
+
+ /*(0.0f)*/
+ Vector2 color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(1.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(2.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(4.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(5.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(6.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ albumLayout->SetColor(color_list);
+
+ DALI_TEST_CHECK(albumLayout->GetColor() == color_list);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetCenterPosition(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetCenterPosition(Vector3( 0.0f,-80.0f,100.0f));
+
+ DALI_TEST_CHECK(albumLayout->GetCenterPosition() == Vector3( 0.0f,-80.0f,100.0f));
+ END_TEST;
+}
+
+int UtcDaliAlbumSetSetCenterScale(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetCenterScale(1.75f);
+
+ DALI_TEST_CHECK(albumLayout->GetCenterScale() == 1.75f);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetSetCenterColor(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetCenterColor(Vector2(1.0f,1.0f));
+
+ DALI_TEST_CHECK(albumLayout->GetCenterColor() == Vector2(1.0f,1.0f));
+ END_TEST;
+}
+
+int UtcDaliAlbumSetStackPosition(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetStackPosition(Vector3(750.0f,-500.0f,0.0f),Vector3(-750.0f,-500.0f,0.0f));
+
+ DALI_TEST_CHECK(albumLayout->GetRightStackPosition() == Vector3(750.0f,-500.0f,0.0f) && albumLayout->GetLeftStackPosition() == Vector3(-750.0f,-500.0f,0.0f));
+ END_TEST;
+}
+
+int UtcDaliAlbumSetSetStackScale(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetStackScale(1.0f,1.0f);
+
+ DALI_TEST_CHECK(albumLayout->GetRightStackScale() == 1.0f && albumLayout->GetLeftStackScale() == 1.0f);
+ END_TEST;
+}
+
+int UtcDaliAlbumSetStackColor(void)
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetStackColor(Vector2(1.0f,1.0f),Vector2(1.0f,1.0f));
+
+ DALI_TEST_CHECK(albumLayout->GetRightStackColor() == Vector2(1.0f,1.0f) && albumLayout->GetLeftStackColor() == Vector2(1.0f,1.0f));
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+
+
+void bendy_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void bendy_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliBendyUninitializedEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::BendyEffect effect;
+
+ try
+ {
+ // New() must be called to create a BendyEffect or it wont be valid.
+ effect.SetRadius( 2.0f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliBendyPropertyNamesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::BendyEffect effect = Toolkit::BendyEffect::New();
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetDirectionPropertyName(), "uDirection", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliBendyDefaultValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::BendyEffect effect = Toolkit::BendyEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 topLeft( Stage::GetCurrent().GetSize() * 0.5f );
+ topLeft.y = -topLeft.y;
+
+ // Gets converted to opengl view space
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName().c_str(),
+ topLeft ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetDirectionPropertyName().c_str(),
+ Vector2(0.0f, 0.0f) ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetRadiusPropertyName().c_str(),
+ 0.0f ) );
+ END_TEST;
+}
+
+int UtcDaliBendyCustomValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::BendyEffect effect = Toolkit::BendyEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ Vector2 direction(1.0f, 1.0f);
+ effect.SetCenter( Vector2(480.0f, 800.0f) );
+ effect.SetDirection( direction );
+ effect.SetRadius( 2.0f );
+
+ actor.SetShaderEffect(effect);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 bottomRight( Stage::GetCurrent().GetSize() * 0.5f );
+ bottomRight.x = -bottomRight.x;
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName().c_str(),
+ bottomRight ) );
+
+ direction.Normalize();
+ direction.x *= -1.0f;
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetDirectionPropertyName().c_str(),
+ direction ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetRadiusPropertyName().c_str(),
+ 2.0f ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+
+
+void blind_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void blind_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliBlindEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::BlindEffect effect;
+
+ try
+ {
+ // New() must be called to create a BlindEffect or it wont be valid.
+ effect.SetStep( 2.0f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliBlindEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::BlindEffect effect = Toolkit::BlindEffect::New();
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliBlindEffectDefaultValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::BlindEffect effect = Toolkit::BlindEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetStepPropertyName().c_str(),
+ 0.0f ) );
+ END_TEST;
+}
+
+int UtcDaliBlindEffectCustomValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::BlindEffect effect = Toolkit::BlindEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ effect.SetStep( 2.0f );
+
+ actor.SetShaderEffect(effect);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetStepPropertyName().c_str(),
+ 2.0f ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+
+void bloom_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void bloom_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+// Negative test case for a method
+int UtcDaliBloomViewUninitialized(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliBloomViewUninitialized");
+
+ Toolkit::BloomView view;
+
+ try
+ {
+ // New() must be called to create a BloomView or it wont be valid.
+ Actor a = Actor::New();
+ view.Add( a );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!view);
+ }
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliBloomViewNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliBloomViewNew");
+
+ Toolkit::BloomView view = Toolkit::BloomView::New();
+ DALI_TEST_CHECK( view );
+
+ Toolkit::BloomView view2 = Toolkit::BloomView::New(10, 1.0f, Pixel::RGB888, 0.5f, 0.5f);
+ DALI_TEST_CHECK( view2 );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliBloomViewDownCast(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliBloomViewDownCast");
+
+ Toolkit::BloomView view = Toolkit::BloomView::New();
+ BaseHandle handle(view);
+
+ Toolkit::BloomView bloomView = Toolkit::BloomView::DownCast( handle );
+ DALI_TEST_CHECK( view );
+ DALI_TEST_CHECK( bloomView );
+ DALI_TEST_CHECK( bloomView == view );
+ END_TEST;
+}
+
+
+// Positive test case for a method
+int UtcDaliBloomViewPropertyNames(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliBloomViewPropertyNames");
+
+ Toolkit::BloomView view = Toolkit::BloomView::New();
+ DALI_TEST_CHECK( view );
+
+ // Check the names, this names are used in the shader code,
+ // if they change in the shader code, then it has to be updated here.
+ DALI_TEST_EQUALS( view.GetBloomThresholdPropertyIndex(), view.GetPropertyIndex("uBloomThreshold"), TEST_LOCATION );
+ DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("BlurStrengthProperty"), TEST_LOCATION );
+ DALI_TEST_EQUALS( view.GetBloomIntensityPropertyIndex(), view.GetPropertyIndex("uBloomIntensity"), TEST_LOCATION );
+ DALI_TEST_EQUALS( view.GetBloomSaturationPropertyIndex(), view.GetPropertyIndex("uBloomSaturation"), TEST_LOCATION );
+ DALI_TEST_EQUALS( view.GetImageIntensityPropertyIndex(), view.GetPropertyIndex("uImageIntensity"), TEST_LOCATION );
+ DALI_TEST_EQUALS( view.GetImageSaturationPropertyIndex(), view.GetPropertyIndex("uImageSaturation"), TEST_LOCATION );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliBloomViewAddRemove(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliBloomViewAddRemove");
+
+ Toolkit::BloomView view = Toolkit::BloomView::New();
+ DALI_TEST_CHECK( view );
+
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK( !actor.OnStage() );
+
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(actor);
+ Stage::GetCurrent().Add(view);
+
+ DALI_TEST_CHECK( actor.OnStage() );
+
+ view.Remove(actor);
+
+ DALI_TEST_CHECK( !actor.OnStage() );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliBloomActivateDeactivate(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliBloomActivateDeactivate");
+
+ Toolkit::BloomView view = Toolkit::BloomView::New();
+ DALI_TEST_CHECK( view );
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(Actor::New());
+ Stage::GetCurrent().Add(view);
+ view.Activate();
+
+ RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
+
+ view.Deactivate();
+
+ RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/public-api/builder/builder.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+//
+// Note: To avoid escaping double quotes single quotes are used and then replaced
+// before parsing. JSON uses double quotes
+//
+ std::string JSON_TEXTSTYLE_ONLY("\
+{ \
+ 'text-styles': \
+ { \
+ 'title-text-style':{'font-name': 'Vera', \
+ 'font-style': 'Bold', \
+ 'point-size': 12.0, \
+ 'weight': 'light', \
+ 'text-color': [0.0,0.5,0.5,1], \
+ 'italic': false, \
+ 'underline': false, \
+ 'shadow': true, \
+ 'glow': true, \
+ 'outline': true, \
+ 'shadow-color': [0.0,1.0,0.0,1.0], \
+ 'shadow-offset': [3.0,2.0], \
+ 'shadow-size': 2.0, \
+ 'glow-color': [0.9,0.6,0.3,1.0], \
+ 'glow-intensity':0.1, \
+ 'smooth-edge': 0.45, \
+ 'outline-color': [1.0,0.5,0.0,1.0], \
+ 'outline-thickness': [0.7,0.6] \
+ } \
+ } \
+} \
+");
+
+ std::string JSON_TEXT_ACTOR("\
+{ \
+ 'styles': \
+ { \
+ 'basic-text': \
+ { \
+ 'type':'TextActor', \
+ 'text':'Hello', \
+ 'font':'', \
+ 'parent-origin':[0.0,0.0,0], \
+ 'anchor-point' :[0.5,0.5,0], \
+ 'size': [150,170,1], \
+ 'position':[-10,10,0] \
+ } \
+ }, \
+ 'animations': \
+ { \
+ 'rotate': \
+ { \
+ 'duration': 10, \
+ 'properties': \
+ [ \
+ { \
+ 'actor':'text', \
+ 'property':'rotation', \
+ 'value':[0, 3, 0, 0], \
+ 'alpha-function': 'EASE_IN_OUT', \
+ 'time-period': {'delay': 0, 'duration': 3 } \
+ } \
+ ] \
+ } \
+ }, \
+ 'stage': \
+ [ \
+ { \
+ 'name':'text', \
+ 'type':'basic-text', \
+ 'text':'Hello' \
+ }, \
+ { \
+ 'name':'text2', \
+ 'type':'basic-text', \
+ 'text':'Hello', \
+ 'signals': \
+ [ \
+ { 'name': 'on-stage', 'action':'set', 'actor':'text2', 'property':'text', 'value':'Jaylo' } \
+ ] \
+ } \
+ ], \
+ 'other': \
+ [ \
+ { \
+ 'name':'other-text', \
+ 'type':'basic-text', \
+ 'text':'Hello' \
+ } \
+ ] \
+} \
+");
+
+
+ std::string JSON_CORE_ACTOR_TREE("\
+{ \
+ 'styles': \
+ { \
+ 'my-camera': { \
+ 'type':'CameraActor', \
+ 'camera-type':'FreeLook', \
+ 'field-of-view': 0.125, \
+ 'aspect-ratio':5.0, \
+ 'near-plane-distance': 100, \
+ 'far-plane-distance': 200 \
+ }, \
+ 'basic-text': { \
+ 'type':'TextActor', \
+ 'text':'Hello', \
+ 'font':'Freesans', \
+ 'smooth-edge':0.2, \
+ 'position': [-10.0, 10.0, -1000.0], \
+ 'size': [300.0, 250.0, 0.0] \
+ }, \
+ 'theme2-text': { \
+ 'type':'TextActor', \
+ 'text':'Hello', \
+ 'font':'Freesans', \
+ 'smooth-edge':0.8 \
+ } \
+ }, \
+ 'stage': \
+ [ \
+ {'name':'txt1', \
+ 'type':'TextActor', \
+ 'text':'Hello World', \
+ 'font':'freesans', \
+ 'parent-origin':'CENTER', \
+ 'actors': \
+ [ \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':50 }, \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':100 }, \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':150 }, \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':200 }, \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':250 } \
+ ] \
+ } \
+ ] \
+} \
+");
+
+
+std::string ReplaceQuotes(const std::string &in_s)
+{
+ std::string s(in_s);
+ // wrong as no embedded quote but had regex link problems
+ std::replace(s.begin(), s.end(), '\'', '"');
+ return s;
+}
+
+} // namespace
+
+
+
+void builder_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void builder_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliBuilderTextActorCreateFromStyle(void)
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliBuilderTextActorCreateFromStyle");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ TextActor actor( TextActor::DownCast( builder.CreateFromStyle("basic-text") ) );
+
+ DALI_TEST_CHECK( actor );
+
+ stage.GetRootLayer().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 v;
+
+ v = actor.GetCurrentPosition();
+ DALI_TEST_CHECK(v.x == -10.0);
+ DALI_TEST_CHECK(v.y == 10.0);
+ DALI_TEST_CHECK(v.z == 0.0);
+
+ v = actor.GetCurrentSize();
+ DALI_TEST_CHECK(v.x == 150.0);
+ DALI_TEST_CHECK(v.y == 170.0);
+ DALI_TEST_CHECK(v.z == 1.0);
+
+ DALI_TEST_CHECK(actor.GetText() == "Hello");
+
+ actor = TextActor::DownCast( builder.CreateFromStyle("*(&^") );
+ DALI_TEST_CHECK(!actor);
+
+ END_TEST;
+}
+
+int UtcDaliBuilderTextActorCreateAnimation(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderTextActorCreateAnimation");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+
+ Animation anim = builder.CreateAnimation("rotate");
+ DALI_TEST_CHECK( anim );
+
+ DALI_TEST_CHECK( 10.0f == anim.GetDuration() );
+
+ END_TEST;
+}
+
+int UtcDaliBuilderTextActorApplyFromStyle(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderTextActorApplyFromStyle");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ TextActor actor = TextActor::New("a");
+
+ builder.ApplyStyle("basic-text", actor);
+
+ DALI_TEST_CHECK( actor );
+
+ Stage::GetCurrent().GetRootLayer().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 v;
+
+ v = actor.GetCurrentPosition();
+ DALI_TEST_CHECK(v.x == -10.0);
+ DALI_TEST_CHECK(v.y == 10.0);
+ DALI_TEST_CHECK(v.z == 0.0);
+
+ v = actor.GetCurrentSize();
+ DALI_TEST_CHECK(v.x == 150.0);
+ DALI_TEST_CHECK(v.y == 170.0);
+ DALI_TEST_CHECK(v.z == 1.0);
+
+ DALI_TEST_CHECK(actor.GetText() == "Hello");
+
+ END_TEST;
+}
+
+int UtcDaliBuilderAddActors(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderAddActors");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+
+ application.SendNotification();
+ application.Render();
+
+ TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("text") );
+
+ DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor.GetText() == "Hello");
+
+ END_TEST;
+}
+
+int UtcDaliBuilderAddActorsOther(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderAddActorsOther");
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ builder.AddActors( "other", rootActor );
+
+ application.SendNotification();
+ application.Render();
+
+ TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("other-text") );
+
+ DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor.GetText() == "Hello");
+
+ END_TEST;
+}
+
+
+int UtcDaliBuilderStyles(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderStyles");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_CORE_ACTOR_TREE));
+
+ BaseHandle handle = builder.CreateFromStyle("my-camera");
+ CameraActor camera = CameraActor::DownCast(handle);
+
+ DALI_TEST_CHECK(camera);
+
+ Property::Value v;
+
+ v = camera.GetProperty( camera.GetPropertyIndex("field-of-view") );
+ DALI_TEST_CHECK( 0.125f == v.Get<float>() );
+
+ v = camera.GetProperty( camera.GetPropertyIndex("aspect-ratio") );
+ DALI_TEST_CHECK( 5.0f == v.Get<float>() );
+
+ handle = builder.CreateFromStyle("basic-text");
+ TextActor textActor = TextActor::DownCast(handle);
+
+ v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") );
+
+ DALI_TEST_CHECK( 0.2f == v.Get<float>() );
+
+ // test ApplyStyle another
+ builder.ApplyStyle("theme2-text", textActor);
+
+ v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") );
+ DALI_TEST_CHECK( 0.8f == v.Get<float>() );
+
+ END_TEST;
+}
+
+int UtcDaliBuilderSetProperty(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderSetProperty");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+
+ application.SendNotification();
+ application.Render();
+
+ TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("text2") );
+
+ DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK( actor.GetText() == "Jaylo" );
+
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void dali_button_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_button_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 );
+const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 );
+const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 );
+const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 );
+const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 );
+const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 );
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestObjectCreatedCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+} // namespace
+
+
+
+// Positive test case for a method
+int UtcDaliButtonNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonNew");
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ DALI_TEST_CHECK( checkBoxButton );
+
+ CheckBoxButton checkBoxButton2( checkBoxButton );
+ DALI_TEST_CHECK( checkBoxButton2 );
+ checkBoxButton2 = NULL;
+
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestObjectCreatedCallback );
+ {
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestObjectCreatedCallback );
+ {
+ PushButton pushButton = PushButton::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ // Test down cast
+ Handle handleButton = checkBoxButton;
+ Button downCastCheckBoxButton = Button::DownCast( handleButton );
+ DALI_TEST_CHECK( downCastCheckBoxButton );
+ CheckBoxButton downCastCheckBoxButton2 = CheckBoxButton::DownCast( handleButton );
+ DALI_TEST_CHECK( downCastCheckBoxButton2 );
+ END_TEST;
+}
+
+int UtcDaliButtonProperties(void)
+{
+ tet_infoline("UtcDaliButtonSetProperty: ");
+ ToolkitTestApplication application;
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ PushButton pushButton = PushButton::New();
+
+ //Test various properties
+ checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("dimmed"), false );
+ DALI_TEST_CHECK( false == checkBoxButton.IsDimmed() );
+
+ checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("dimmed"), true );
+ DALI_TEST_CHECK( true == checkBoxButton.IsDimmed() );
+ END_TEST;
+}
+
+int UtcDaliButtonSetGetDimmed(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetGetDimmed");
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ checkBoxButton.SetDimmed( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsDimmed() );
+ checkBoxButton.SetDimmed( false );
+
+ DALI_TEST_CHECK( !checkBoxButton.IsDimmed() );
+ checkBoxButton.SetDimmed( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsDimmed() );
+ checkBoxButton.SetDimmed( false );
+
+ DALI_TEST_CHECK( !checkBoxButton.IsDimmed() );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+
+void carousel_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void carousel_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliCarouselEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::CarouselEffect effect;
+
+ try
+ {
+ // New() must be called to create a CarouselEffect or it wont be valid.
+ effect.SetRadius( 100.0f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliCarouselEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New();
+
+ // Check the names, these names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetAnglePerUnitPropertyName(), "uAnglePerUnit", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliCarouselEffectDefaultValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ const float radiusValue(0.0f);
+ const Vector2 centerValue(0.0f, 0.0f);
+ const Vector2 anglePerUnitValue(0.0f, 0.0f);
+
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAnglePerUnitPropertyName().c_str(), anglePerUnitValue ) );
+ END_TEST;
+}
+
+int UtcDaliCarouselEffectCustomValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ const float radiusValue(100.0f);
+ const Vector2 centerValue(150.0f, 200.0f);
+ const Vector2 anglePerUnitValue(0.1f, 0.25f);
+
+ effect.SetRadius( radiusValue );
+ effect.SetCenter( centerValue );
+ effect.SetAnglePerUnit( anglePerUnitValue );
+
+ actor.SetShaderEffect(effect);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAnglePerUnitPropertyName().c_str(), anglePerUnitValue ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+
+static bool gCheckBoxButtonState = false;
+bool CheckBoxButtonClicked( Button button )
+{
+ gCheckBoxButtonState = static_cast<CheckBoxButton&>( button ).IsChecked();
+ return true;
+}
+
+
+
+Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
+{
+ BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 );
+
+ // Create the image
+ PixelBuffer* pixbuf = imageData.GetBuffer();
+ unsigned int size = width * height;
+
+ for( size_t i = 0; i < size; i++ )
+ {
+ pixbuf[i*4+0] = 0xFF * color.r;
+ pixbuf[i*4+1] = 0xFF * color.g;
+ pixbuf[i*4+2] = 0xFF * color.b;
+ pixbuf[i*4+3] = 0xFF * color.a;
+ }
+
+ imageData.Update();
+
+ return imageData;
+}
+
+} // namespace
+
+
+void checkbox_button_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void checkbox_button_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliCheckBoxButtonSetGetChecked(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCheckBoxButtonSetGetChecked");
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ checkBoxButton.ClickedSignal().Connect( &CheckBoxButtonClicked );
+
+ // global var used to check if CheckBoxButtonClicked is called;
+ gCheckBoxButtonState = false;
+
+ checkBoxButton.SetChecked( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsChecked() );
+ DALI_TEST_CHECK( gCheckBoxButtonState );
+
+ checkBoxButton.SetChecked( false );
+
+ DALI_TEST_CHECK( !checkBoxButton.IsChecked() );
+ DALI_TEST_CHECK( !gCheckBoxButtonState );
+
+ checkBoxButton.SetChecked( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsChecked() );
+ DALI_TEST_CHECK( gCheckBoxButtonState );
+ END_TEST;
+}
+
+int UtcDaliCheckBoxButtonSetImages(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCheckBoxButtonSetImages");
+
+ Actor imageActor;
+
+ Image image01 = CreateSolidColorImage( Color::RED, 10, 10 );
+ ImageActor imageActor01 = CreateSolidColorActor( Color::RED );
+ imageActor01.SetSize( 20, 20 );
+
+ Image image02 = CreateSolidColorImage( Color::RED, 30, 30 );
+ ImageActor imageActor02 = CreateSolidColorActor( Color::RED );
+ imageActor02.SetSize( 40, 40 );
+
+ Image image03 = CreateSolidColorImage( Color::RED, 50, 50 );
+ ImageActor imageActor03 = CreateSolidColorActor( Color::RED );
+ imageActor03.SetSize( 60, 60 );
+
+ Image image04 = CreateSolidColorImage( Color::RED, 70, 70 );
+ ImageActor imageActor04 = CreateSolidColorActor( Color::RED );
+ imageActor04.SetSize( 80, 80 );
+
+ Vector3 size;
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+
+ application.SendNotification();
+ application.Render();
+
+ // Just check if check box button size changes when a bigger image is set.
+
+ checkBoxButton.SetBackgroundImage( image01 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+
+ checkBoxButton.SetBackgroundImage( imageActor01 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION );
+
+ checkBoxButton.SetCheckedImage( image02 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetCheckedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION );
+
+ checkBoxButton.SetCheckedImage( imageActor02 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetCheckedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION );
+
+ checkBoxButton.SetDimmedBackgroundImage( image03 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetDimmedBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION );
+
+ checkBoxButton.SetDimmedBackgroundImage( imageActor03 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetDimmedBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION );
+
+ checkBoxButton.SetDimmedCheckedImage( image04 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetDimmedCheckedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION );
+
+ checkBoxButton.SetDimmedCheckedImage( imageActor04 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetDimmedCheckedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+} // namespace
+
+
+void cluster_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void cluster_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliClusterNew(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the Cluster actor
+ ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ Cluster cluster = Cluster::New(style);
+
+ DALI_TEST_CHECK(cluster);
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ Cluster cluster = Cluster::New(style);
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliClusterDownCast(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the Cluster actor
+ ClusterStyle style = ClusterStyleRandom::New();
+ const Cluster clusterConst = Cluster::New(style);
+ Cluster cluster(clusterConst);
+
+ BaseHandle handle(cluster);
+
+ Cluster newCluster = Cluster::DownCast( handle );
+ DALI_TEST_CHECK( cluster );
+ DALI_TEST_CHECK( newCluster == cluster );
+ END_TEST;
+}
+
+int UtcDaliClusterAddAndRemoveChild(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the Cluster actor
+ ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ Cluster cluster = Cluster::New(style);
+
+ Actor childActor1 = Actor::New();
+ Actor childActor2 = Actor::New();
+ Actor childActor3 = Actor::New();
+ Actor childActor4 = Actor::New();
+
+ // Add the first child and check it is added to the end
+ cluster.AddChild(childActor1);
+ DALI_TEST_CHECK( cluster.GetChildAt(0) == childActor1);
+ DALI_TEST_CHECK( !cluster.GetChildAt(1) );
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 1 );
+
+ // Add the second child to the given position and check it is added
+ cluster.AddChild(childActor2, 1);
+ DALI_TEST_CHECK( cluster.GetChildAt(1) == childActor2);
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 2 );
+
+ // Add the third child with depth index 1 and check it is added to the end
+ cluster.AddChildAt(childActor3, 1);
+ DALI_TEST_CHECK( cluster.GetChildAt(2) == childActor3);
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 3 );
+
+ // Add the fourth child with depth index 2 to the given position and check it is added
+ cluster.AddChildAt(childActor4, 2, 3);
+ DALI_TEST_CHECK( cluster.GetChildAt(3) == childActor4);
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 4 );
+
+ // Remove the child in the given position and check it's removed
+ cluster.RemoveChildAt(3);
+ DALI_TEST_CHECK( !cluster.GetChildAt(3) );
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 3 );
+ END_TEST;
+}
+
+int UtcDaliClusterExpandAndCollapseChild(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the Cluster actor
+ ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ Cluster cluster = Cluster::New(style);
+
+ Actor childActor1 = Actor::New();
+ Actor childActor2 = Actor::New();
+ Actor childActor3 = Actor::New();
+ Actor childActor4 = Actor::New();
+
+ // Add the child actors
+ cluster.AddChild(childActor1);
+ cluster.AddChild(childActor2);
+ cluster.AddChildAt(childActor3, 1);
+ cluster.AddChildAt(childActor4, 2, 3);
+
+ // Expand child actor 3
+ cluster.ExpandChild(2);
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 1 );
+
+ // Expand child actor 4
+ cluster.ExpandChild(3);
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 2 );
+
+ // Collapse child actor 3
+ cluster.CollapseChild(2);
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 1 );
+
+ // Expand all children
+ cluster.ExpandAllChildren();
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 4 );
+
+ // Collpase all children
+ cluster.CollapseAllChildren();
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 0 );
+
+ // Transform and restore the child
+ cluster.TransformChild(1, Vector3(10.0f, 10.0f, 1.0f), Vector3(1.0f, 1.0f, 1.0f), Quaternion(0.0f, Vector3::YAXIS), AlphaFunctions::EaseOut, 0.5f);
+ cluster.RestoreChild(1, AlphaFunctions::EaseOut, 0.25f, true);
+ END_TEST;
+}
+
+int UtcDaliClusterSetAndGetStyle(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the default cluster style
+ ClusterStyle defaultStyle = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ DALI_TEST_CHECK( defaultStyle.GetMaximumNumberOfChildren() > 0 );
+
+ // Add style to background and title
+ Actor background = Actor::New();
+ Actor title = Actor::New();
+ defaultStyle.ApplyStyleToBackground(background, AlphaFunctions::EaseOut, 1.0f);
+ defaultStyle.ApplyStyleToTitle(title, AlphaFunctions::EaseOut, 1.0f);
+
+ // Create the Cluster actor with the default style
+ Cluster cluster = Cluster::New(defaultStyle);
+ DALI_TEST_CHECK( cluster.GetStyle() == defaultStyle );
+ cluster.SetBackgroundImage(background);
+ cluster.SetTitle(title);
+
+ // Create a new style and apply it to the cluster
+ ClusterStyle newStyle = ClusterStyleRandom::New();
+ cluster.SetStyle(newStyle);
+ DALI_TEST_CHECK( cluster.GetStyle() == newStyle );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/long-press-gesture-event.h>
+#include <dali/integration-api/events/pinch-gesture-event.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali/integration-api/events/tap-gesture-event.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+
+#include "dummy-control.h"
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+
+void control_impl_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void control_impl_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliControlImplTypeRegistry(void)
+{
+ ToolkitTestApplication application;
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "Control" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ // Check if it's a control
+ DALI_TEST_CHECK( Control::DownCast(handle) );
+ END_TEST;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+namespace
+{
+static bool MouseWheelEventCallback(Actor actor, const MouseWheelEvent& event)
+{
+ return false;
+}
+}
+
+int UtcDaliControlImplMouseWheelEvent(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ dummy.SetSize(100.0f, 100.0f);
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, false, TEST_LOCATION );
+
+ // simulate a mouse wheel event
+ Vector2 screenCoordinates( 10.0f, 10.0f );
+ Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u);
+ application.ProcessEvent(event);
+ DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ dummy.SetSize(100.0f, 100.0f);
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ // simulate a mouse wheel event
+ Vector2 screenCoordinates( 20.0f, 20.0f );
+ Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u);
+ application.ProcessEvent(event);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+
+namespace
+{
+const unsigned int NUM_ROWS = 16;
+const unsigned int NUM_COLUMNS = 10;
+const Vector2 VIEW_AREA_SIZE( 480.0f, 800.0f );
+const float TRANSITION_DURATION = 0.5f;
+const float CUBE_DISPLACEMENT = 55.f;
+const Vector2 PAN_POSITION1( VIEW_AREA_SIZE.x * 0.75f, VIEW_AREA_SIZE.y * 0.25f );
+const Vector2 PAN_DISPLACEMENT1( -5.f, 5.f );
+const Vector2 PAN_POSITION2( VIEW_AREA_SIZE.x * 0.25f, VIEW_AREA_SIZE.y * 0.75f );
+const Vector2 PAN_DISPLACEMENT2( 5.f, 5.f );
+const int RENDER_FRAME_INTERVAL = 16;
+static const float ROTATION_EPSILON = 0.0001f;
+const float OFFSCREEN_RENDER_DURATION = 0.05f;
+
+static bool gObjectCreatedCallBackCalled;
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+/**
+ * Simulate time passed by, waiting for certain process to finish
+ * @param[in] application Test application instance
+ * @param[in] durationToPass Time to pass in milliseconds.
+ */
+void Wait(ToolkitTestApplication& application, float durationToPass)
+{
+ int duration = static_cast<int>(durationToPass*1000.f);
+ // wait 2 more frames to compensate the two frames used by the bitmapImage waiting for the loading succeeded signal
+ for(int i = 0; i <= duration/RENDER_FRAME_INTERVAL+2 ; i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ }
+}
+
+
+
+//Callback class to test whether transition completed signal is emitted when the transition animation is finished
+class TransitionCompletedCallback : public Dali::ConnectionTracker
+{
+public:
+ TransitionCompletedCallback( bool& signalReceived, CubeTransitionEffect& effect, ImageActor& imageActor )
+ : mSignalVerified( signalReceived ),
+ mCurrentEffect( effect ),
+ mActorTransitTo( imageActor )
+ {
+ }
+
+ void Callback( CubeTransitionEffect effect, ImageActor imageActor )
+ {
+ tet_infoline( "Verifying TransitionCompletedSignal" );
+
+ if( mCurrentEffect == effect && mActorTransitTo == imageActor )
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ CubeTransitionEffect& mCurrentEffect;
+ ImageActor& mActorTransitTo;
+};
+
+} // namespace
+
+
+
+void cube_transition_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void cube_transition_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliCubeTransitionWaveEffectNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionWaveEffectNew ");
+
+ CubeTransitionEffect waveEffect;
+
+ DALI_TEST_CHECK( !waveEffect );
+
+ waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+
+ DALI_TEST_CHECK( waveEffect );
+
+ waveEffect = NULL;
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionCrossEffectNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionCrossEffectNew ");
+
+ CubeTransitionEffect crossEffect;
+
+ DALI_TEST_CHECK( !crossEffect );
+
+ crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+
+ DALI_TEST_CHECK( crossEffect );
+
+ crossEffect = NULL;
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionFoldEffectNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliCubeTransitionFoldEffectNew " );
+
+ CubeTransitionEffect foldEffect;
+
+ DALI_TEST_CHECK( !foldEffect );
+
+ foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+
+ DALI_TEST_CHECK( foldEffect );
+
+ foldEffect = NULL;
+
+ //Additional check to ensure object is created by checking if it is registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionEffectSetGetTransitionDuration(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ waveEffect.SetTransitionDuration( TRANSITION_DURATION );
+ DALI_TEST_EQUALS( TRANSITION_DURATION, waveEffect.GetTransitionDuration(), TEST_LOCATION );
+
+ CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ crossEffect.SetTransitionDuration( TRANSITION_DURATION );
+ DALI_TEST_EQUALS( TRANSITION_DURATION, crossEffect.GetTransitionDuration(), TEST_LOCATION );
+
+ CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ foldEffect.SetTransitionDuration( TRANSITION_DURATION );
+ DALI_TEST_EQUALS( TRANSITION_DURATION, foldEffect.GetTransitionDuration(), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionEffectSetGetCubeDisplacement(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionEffectSetGetTransitionDuration ");
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ DALI_TEST_EQUALS( CUBE_DISPLACEMENT, waveEffect.GetCubeDisplacement(), TEST_LOCATION );
+
+ CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ DALI_TEST_EQUALS( CUBE_DISPLACEMENT, crossEffect.GetCubeDisplacement(), TEST_LOCATION );
+
+ //Cube displacement is not used in CubeTransitionFoldEffect
+ END_TEST;
+}
+
+//Test common codes in base class
+int UtcDaliCubeTransitionEffectGetRoot(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionEffectGetRoot ");
+
+ unsigned int totalNum = NUM_ROWS*NUM_COLUMNS;
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ Actor rootActor = waveEffect.GetRoot();
+
+ // check that we have a total of NUM_ROWS*NUM_COLUMNS cubes;
+ DALI_TEST_CHECK( totalNum == rootActor.GetChildCount() );
+
+ // check that every cube has two children
+ DALI_TEST_CHECK( 2 == rootActor.GetChildAt(0).GetChildCount() );
+ DALI_TEST_CHECK( 2 == rootActor.GetChildAt(totalNum/2).GetChildCount() );
+ DALI_TEST_CHECK( 2 == rootActor.GetChildAt(totalNum-1).GetChildCount() );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionEffectIsTransiting(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionEffectIsTransiting ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ Actor rootActor = waveEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+
+ waveEffect.SetTransitionDuration( TRANSITION_DURATION );
+ waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ DALI_TEST_CHECK( !waveEffect.IsTransiting() );
+
+ waveEffect.SetCurrentImage(imageActor);
+ waveEffect.SetTargetImage(imageActor);
+ //transition is started
+ waveEffect.StartTransition();
+ DALI_TEST_CHECK( waveEffect.IsTransiting() );
+ //transition is finished
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK( !waveEffect.IsTransiting() );
+
+ CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ crossEffect.SetTransitionDuration( TRANSITION_DURATION );
+ crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ DALI_TEST_CHECK( !crossEffect.IsTransiting() );
+
+ crossEffect.SetCurrentImage(imageActor);
+ crossEffect.SetTargetImage(imageActor);
+ //transition is started
+ crossEffect.StartTransition(false);
+ DALI_TEST_CHECK( crossEffect.IsTransiting() );
+ //transition is finished
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK( !crossEffect.IsTransiting() );
+
+ CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ foldEffect.SetTransitionDuration( TRANSITION_DURATION );
+ DALI_TEST_CHECK( !foldEffect.IsTransiting() );
+
+ foldEffect.SetCurrentImage( imageActor );
+ foldEffect.SetTargetImage( imageActor );
+ //transition is started
+ foldEffect.StartTransition(true);
+ DALI_TEST_CHECK(foldEffect.IsTransiting() );
+ //transition is finished
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK( !foldEffect.IsTransiting() );
+
+ END_TEST;
+}
+
+//Test common codes in base class
+int UtcDaliCubeTransitionEffectSetCurrentImage(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentImage ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,40,40) ;
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ waveEffect.SetCurrentImage( imageActor );
+
+ // the current image content is set to the tiles facing the camera
+ ImageActor tile = ImageActor::DownCast( (waveEffect.GetRoot().GetChildAt(0).GetChildAt(0)));
+
+ //check the pixel area set to the cube
+ ImageActor::PixelArea pixelAreaDef( 0, 0, VIEW_AREA_SIZE.x / NUM_COLUMNS, VIEW_AREA_SIZE.y / NUM_ROWS);
+ ImageActor::PixelArea pixelArea = tile.GetPixelArea();
+ DALI_TEST_CHECK ( pixelAreaDef == pixelArea );
+
+ //check the size of the off screen rendered image
+ Wait( application, OFFSCREEN_RENDER_DURATION );
+ ImageAttributes attributes( tile.GetImage().GetAttributes() );
+ DALI_TEST_EQUALS( static_cast<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<float>(attributes.GetHeight()), VIEW_AREA_SIZE.y, TEST_LOCATION );
+ END_TEST;
+}
+
+//Test common codes in base class
+int UtcDaliCubeTransitionEffectSetTargetImage(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionEffectSetTargetImage ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ Actor rootActor = waveEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+
+ waveEffect.SetCurrentImage( imageActor );
+ waveEffect.SetTargetImage( imageActor );
+
+ // the target image content is set to the tiles currently invisible to the camera
+ ImageActor tile = ImageActor::DownCast( (rootActor.GetChildAt(0).GetChildAt(1)));
+
+ //check the pixel area set to the cube
+ ImageActor::PixelArea pixelAreaDef( 0, 0, VIEW_AREA_SIZE.x / NUM_COLUMNS, VIEW_AREA_SIZE.y / NUM_ROWS);
+ ImageActor::PixelArea pixelArea = tile.GetPixelArea();
+ DALI_TEST_CHECK ( pixelAreaDef == pixelArea );
+
+ //check the size of the off screen rendered image
+ Wait( application, OFFSCREEN_RENDER_DURATION );
+ ImageAttributes attributes( tile.GetImage().GetAttributes() );
+ DALI_TEST_EQUALS( static_cast<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<float>(attributes.GetHeight()), VIEW_AREA_SIZE.y, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionWaveEffectStartTransition(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ waveEffect.SetTransitionDuration( TRANSITION_DURATION );
+ waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ Actor rootActor = waveEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+ Actor cube = rootActor.GetChildAt(0);
+
+ waveEffect.SetCurrentImage( imageActor );
+
+ Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
+ Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
+
+ //check the cube rotation value and color values after different transitions
+ waveEffect.SetTargetImage( imageActor );
+ waveEffect.StartTransition(true);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ waveEffect.SetTargetImage( imageActor );
+ waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness );
+
+ waveEffect.SetTargetImage( imageActor );
+ waveEffect.StartTransition(false);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ waveEffect.SetTargetImage( imageActor );
+ waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionCrossEffectStartTransition(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
+
+ CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ crossEffect.SetTransitionDuration( TRANSITION_DURATION );
+ crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ Actor rootActor = crossEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+ crossEffect.SetCurrentImage( imageActor );
+ Actor cube0 = rootActor.GetChildAt(0);
+ Actor cube1 = rootActor.GetChildAt(1);
+
+ Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
+ Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
+
+ //check the cube rotation values and color values after different transitions
+ crossEffect.SetTargetImage( imageActor );
+ crossEffect.StartTransition(true);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ crossEffect.SetTargetImage( imageActor );
+ crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
+
+
+ crossEffect.SetTargetImage( imageActor );
+ crossEffect.StartTransition(false);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ crossEffect.SetTargetImage( imageActor );
+ crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionFoldEffectStartTransition(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionFoldEffectStartTransition ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
+
+ CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ foldEffect.SetTransitionDuration( TRANSITION_DURATION );
+ Actor rootActor = foldEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+ foldEffect.SetCurrentImage( imageActor );
+ Actor cube0 = rootActor.GetChildAt(0);
+ Actor cube1 = rootActor.GetChildAt(1);
+
+ Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
+ Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
+
+ //check the cube rotation values and color values after different transitions
+ foldEffect.SetTargetImage( imageActor );
+ foldEffect.StartTransition(true);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ foldEffect.SetTargetImage( imageActor );
+ foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
+
+
+ foldEffect.SetTargetImage( imageActor );
+ foldEffect.StartTransition(false);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ foldEffect.SetTargetImage( imageActor );
+ foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionEffectSignalTransitionCompleted(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionEffectSignalTransitionCompleted ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
+ ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
+ ImageActor thirdImageActor = CreateSolidColorImageActor(application, Color::BLUE,40,40);
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ waveEffect.SetTransitionDuration( TRANSITION_DURATION );
+ waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ Actor rootActor = waveEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+
+ CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ crossEffect.SetTransitionDuration( TRANSITION_DURATION );
+ crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ rootActor = crossEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+
+ CubeTransitionEffect foldEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ foldEffect.SetTransitionDuration( TRANSITION_DURATION );
+ rootActor = foldEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+
+ bool signalVerified = false;
+ CubeTransitionEffect currentEffect;
+ ImageActor actorTransitTo;
+ TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
+ waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
+ crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
+ foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
+
+ //check that the wave effect is used to transit to secondImageActor
+ currentEffect = waveEffect;
+ actorTransitTo = secondImageActor;
+ waveEffect.SetCurrentImage( firstImageActor );
+ waveEffect.SetTargetImage( secondImageActor );
+ waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ //check that the wave effect is used to transit to thirdImageActor
+ actorTransitTo = thirdImageActor;
+ waveEffect.SetTargetImage( thirdImageActor );
+ waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ //check that the cross effect is used to transit to secondImageActor
+ currentEffect = crossEffect;
+ actorTransitTo = secondImageActor;
+ crossEffect.SetCurrentImage( thirdImageActor );
+ crossEffect.SetTargetImage( secondImageActor );
+ crossEffect.StartTransition(true);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ //check that the cross effect is used to transit to firstImageActor
+ actorTransitTo = firstImageActor;
+ crossEffect.SetTargetImage( firstImageActor );
+ crossEffect.StartTransition(false);
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ //check that the fold effect is used to transit to secondImageActor
+ currentEffect = foldEffect;
+ actorTransitTo = secondImageActor;
+ foldEffect.SetCurrentImage( firstImageActor );
+ foldEffect.SetTargetImage( secondImageActor );
+ foldEffect.StartTransition();
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK( callback.mSignalVerified );
+ callback.Reset();
+
+ //check that the fold effect is used to transit to thirdImageActor
+ actorTransitTo = thirdImageActor;
+ foldEffect.SetTargetImage( thirdImageActor );
+ foldEffect.StartTransition( false );
+ Wait( application, TRANSITION_DURATION );
+ DALI_TEST_CHECK( callback.mSignalVerified );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionEffectPauseResumeTransition(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionEffectPauseResumeTransition ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
+ ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ waveEffect.SetTransitionDuration( TRANSITION_DURATION );
+ waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ Actor rootActor = waveEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+
+ CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ crossEffect.SetTransitionDuration( TRANSITION_DURATION );
+ crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ rootActor = crossEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+
+ CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ foldEffect.SetTransitionDuration( TRANSITION_DURATION );
+ rootActor = crossEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+
+ bool signalVerified = false;
+ CubeTransitionEffect currentEffect;
+ ImageActor actorTransitTo;
+ TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
+ waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
+ crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
+ foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
+
+ currentEffect = waveEffect;
+ actorTransitTo = secondImageActor;
+ waveEffect.SetCurrentImage( firstImageActor );
+ waveEffect.SetTargetImage( secondImageActor );
+ // start transition; transit for 0.5*duration; pause for 0.5*duration;
+ // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
+ // only until now the transition finished signal can be received
+ waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION*0.5f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ waveEffect.PauseTransition();
+ Wait( application, TRANSITION_DURATION*0.5f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ waveEffect.ResumeTransition();
+ Wait( application, TRANSITION_DURATION*0.25f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ waveEffect.PauseTransition();
+ Wait( application, TRANSITION_DURATION*0.25f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ waveEffect.ResumeTransition();
+ Wait( application, TRANSITION_DURATION*0.25f );
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ currentEffect = crossEffect;
+ actorTransitTo = firstImageActor;
+ crossEffect.SetCurrentImage( secondImageActor );
+ crossEffect.SetTargetImage( firstImageActor );
+ // start transition; transit for 0.25*duration; pause for 0.2*duration;
+ // resume for 0.5*duration; pause for 0.2*duration; resume for another 0.25*duration;
+ // only until now the transition finished signal can be received
+ crossEffect.StartTransition(false);
+ Wait( application, TRANSITION_DURATION*0.25f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ crossEffect.PauseTransition();
+ Wait( application, TRANSITION_DURATION*0.2f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ crossEffect.ResumeTransition();
+ Wait( application, TRANSITION_DURATION*0.5f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ crossEffect.PauseTransition();
+ Wait( application, TRANSITION_DURATION*0.2f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ crossEffect.ResumeTransition();
+ Wait( application, TRANSITION_DURATION*0.25f );
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ currentEffect = foldEffect;
+ actorTransitTo = secondImageActor;
+ foldEffect.SetCurrentImage( firstImageActor );
+ foldEffect.SetTargetImage( secondImageActor );
+ // start transition; transit for 0.5*duration; pause for 0.5*duration;
+ // resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
+ // only until now the transition finished signal can be received
+ foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION*0.5f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ foldEffect.PauseTransition();
+ Wait( application, TRANSITION_DURATION*0.5f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ foldEffect.ResumeTransition();
+ Wait( application, TRANSITION_DURATION*0.25f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ foldEffect.PauseTransition();
+ Wait( application, TRANSITION_DURATION*0.25f );
+ DALI_TEST_CHECK(!callback.mSignalVerified);
+ foldEffect.ResumeTransition();
+ Wait( application, TRANSITION_DURATION*0.25f );
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionWaveEffectStopTransition(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionWaveEffectStopTransition ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
+ ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
+
+ CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ waveEffect.SetTransitionDuration( TRANSITION_DURATION );
+ waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ Actor rootActor = waveEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+ Actor cube = rootActor.GetChildAt(0);
+ waveEffect.SetCurrentImage( firstImageActor );
+
+ Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
+ Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
+
+ //check the cube rotation value and color values after stopping different transitions in the middle
+ waveEffect.SetTargetImage( secondImageActor );
+ waveEffect.StartTransition(true);
+ Wait( application, TRANSITION_DURATION*0.2f );
+ waveEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ waveEffect.SetTargetImage( firstImageActor );
+ waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION*0.4f );
+ waveEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness );
+
+ waveEffect.SetTargetImage( secondImageActor );
+ waveEffect.StartTransition(false);
+ Wait( application, TRANSITION_DURATION*0.6f );
+ waveEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ waveEffect.SetTargetImage( firstImageActor );
+ waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
+ Wait( application, TRANSITION_DURATION*0.8f );
+ waveEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube.GetChildAt(1).GetCurrentColor() == halfBrightness );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionCrossEffectStopTransition(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionCrossEffectStopTransition ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
+ ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
+
+ CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ crossEffect.SetTransitionDuration( TRANSITION_DURATION );
+ crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
+ Actor rootActor = crossEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+ crossEffect.SetCurrentImage( firstImageActor );
+ Actor cube0 = rootActor.GetChildAt(0);
+ Actor cube1 = rootActor.GetChildAt(1);
+
+ Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
+ Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
+
+ //check the cube rotation values and color values after stop the different transitions in the middle
+ crossEffect.SetTargetImage( secondImageActor );
+ crossEffect.StartTransition(true);
+ Wait( application, TRANSITION_DURATION*0.2f );
+ crossEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
+
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ crossEffect.SetTargetImage( firstImageActor );
+ crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION*0.4f );
+ crossEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
+
+ crossEffect.SetTargetImage( secondImageActor );
+ crossEffect.StartTransition(false);
+ Wait( application, TRANSITION_DURATION*0.6f );
+ crossEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ crossEffect.SetTargetImage( firstImageActor );
+ crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
+ Wait( application, TRANSITION_DURATION*0.8f );
+ crossEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
+ END_TEST;
+}
+
+int UtcDaliCubeTransitionFoldEffectStopTransition(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCubeTransitionFoldEffectStopTransition ");
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ ImageActor firstImageActor = CreateSolidColorImageActor(application, Color::RED,30,30);
+ ImageActor secondImageActor = CreateSolidColorImageActor(application, Color::GREEN,20,20);
+
+ CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
+ foldEffect.SetTransitionDuration( TRANSITION_DURATION );
+ Actor rootActor = foldEffect.GetRoot();
+ Stage::GetCurrent().Add( rootActor );
+ foldEffect.SetCurrentImage( firstImageActor );
+ Actor cube0 = rootActor.GetChildAt(0);
+ Actor cube1 = rootActor.GetChildAt(1);
+
+ Vector4 fullBrightness = Vector4(1.f,1.f,1.f,1.f);
+ Vector4 halfBrightness = Vector4(0.5f, 0.5f, 0.5f, 1.f);
+
+ //check the cube rotation values and color values after stop the different transitions in the middle
+ foldEffect.SetTargetImage( secondImageActor );
+ foldEffect.StartTransition(true);
+ Wait( application, TRANSITION_DURATION*0.2f );
+ foldEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ foldEffect.SetTargetImage( firstImageActor );
+ foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
+ Wait( application, TRANSITION_DURATION*0.4f );
+ foldEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
+
+ foldEffect.SetTargetImage( secondImageActor );
+ foldEffect.StartTransition(false);
+ Wait( application, TRANSITION_DURATION*0.6f );
+ foldEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == halfBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == fullBrightness );
+
+ foldEffect.SetTargetImage( firstImageActor );
+ foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
+ Wait( application, TRANSITION_DURATION*0.8f );
+ foldEffect.StopTransition();
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_CHECK( cube0.GetChildAt(0).GetCurrentColor() == fullBrightness );
+ DALI_TEST_CHECK( cube0.GetChildAt(1).GetCurrentColor() == halfBrightness );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void dali_default_controls_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_default_controls_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+
+int UtcDaliDefaultControlsCreateCheckBoxButton(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliDefaultControlsCreateCheckBoxButton");
+
+ const std::string imagePath( "Facke image path" );
+ const std::string voidImagePath( "" );
+
+ ImageActor image = CreateSolidColorActor( Color::RED );
+ ImageActor voidImage;
+
+ CheckBoxButton button0, button1, button2, button3, button4, button5;
+
+ try
+ {
+ button0 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath );
+ button1 = CreateCheckBoxButton( imagePath, voidImagePath, voidImagePath, voidImagePath );
+ button2 = CreateCheckBoxButton( voidImagePath, imagePath, voidImagePath, voidImagePath );
+ button3 = CreateCheckBoxButton( voidImagePath, voidImagePath, imagePath, voidImagePath );
+ button4 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, imagePath );
+ button5 = CreateCheckBoxButton( imagePath, imagePath, imagePath, imagePath );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ DALI_TEST_CHECK( button4 );
+ DALI_TEST_CHECK( button5 );
+
+ try
+ {
+ button0 = CreateCheckBoxButton( voidImage, voidImage, voidImage, voidImage );
+ button1 = CreateCheckBoxButton( image, voidImage, voidImage, voidImage );
+ button2 = CreateCheckBoxButton( voidImage, image, voidImage, voidImage );
+ button3 = CreateCheckBoxButton( voidImage, voidImage, image, voidImage );
+ button4 = CreateCheckBoxButton( voidImage, voidImage, voidImage, image );
+ button5 = CreateCheckBoxButton( image, image, image, image );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ DALI_TEST_CHECK( button4 );
+ DALI_TEST_CHECK( button5 );
+
+ try
+ {
+ button0 = CreateCheckBoxButton( voidImagePath, voidImagePath );
+ button1 = CreateCheckBoxButton( voidImagePath, imagePath );
+ button2 = CreateCheckBoxButton( imagePath, voidImagePath );
+ button3 = CreateCheckBoxButton( imagePath, imagePath );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+
+ try
+ {
+ button0 = CreateCheckBoxButton( voidImage, voidImage );
+ button2 = CreateCheckBoxButton( voidImage, image );
+ button3 = CreateCheckBoxButton( voidImage, image );
+ button4 = CreateCheckBoxButton( image, image );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <float.h> // for FLT_MAX
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+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<float>(numberOfColumns + 1)) * 0.8f;
+ return Vector3(width, width, width);
+}
+
+float DepthLayoutBottomMarginFunction(float layoutHeight)
+{
+ return layoutHeight * 0.25f;
+}
+
+float DepthLayoutColumnPositionFunction(unsigned int numberOfColumns, unsigned int columnNumber, const Vector3& itemSize, float layoutWidth)
+{
+ float availableSpace = layoutWidth - itemSize.width * numberOfColumns;
+ float leftMargin = availableSpace / numberOfColumns * 0.5f;
+ float columnPosition = leftMargin + itemSize.width * 0.5f + columnNumber * (itemSize.width + availableSpace / numberOfColumns);
+ return columnPosition - layoutWidth * 0.5f;
+}
+} // namespace
+
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an test actor for this item
+ ImageActor actor = CreateSolidColorActor(Color::RED);
+ actor.SetSize(64.0f, 64.0f);
+
+ return actor;
+ }
+};
+
+
+void depth_layout_startup(void)
+{
+}
+
+void depth_layout_cleanup(void)
+{
+}
+
+int UtcDaliDepthLayoutNew(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ DALI_TEST_CHECK(depthLayout);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetNumberOfColumns(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the number of columns
+ depthLayout->SetNumberOfColumns(5);
+
+ // Check whether we get the correct number of columns
+ DALI_TEST_CHECK(depthLayout->GetNumberOfColumns() == 5);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetNumberOfRows(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the number of rows
+ depthLayout->SetNumberOfRows(15);
+
+ // Check whether we get the correct number of rows
+ DALI_TEST_CHECK(depthLayout->GetNumberOfRows() == 15);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetRowSpacing(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the row spacing
+ depthLayout->SetRowSpacing(30.0f);
+
+ // Check whether we get the correct row spacing
+ DALI_TEST_EQUALS(depthLayout->GetRowSpacing(), 30.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetTiltAngle(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the tilt angle
+ depthLayout->SetTiltAngle(Degree(25.0f));
+
+ // Check whether we get the correct tilt angle
+ DALI_TEST_EQUALS(float(depthLayout->GetTiltAngle()), 25.0f, 0.001f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetItemSizeFunction(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the item size function
+ depthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunction);
+
+ // Check whether we get the correct item size function
+ DALI_TEST_CHECK(depthLayout->GetItemSizeFunction() == DepthLayoutItemSizeFunction);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetBottomMarginFunction(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the bottom margin function
+ depthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunction);
+
+ // Check whether we get the correct bottom margin function
+ DALI_TEST_CHECK(depthLayout->GetBottomMarginFunction() == DepthLayoutBottomMarginFunction);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetItemTiltAngle(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the item's tilt angle
+ depthLayout->SetItemTiltAngle(Degree(5.0f));
+
+ // Check whether we get the correct item's tilt angle
+ DALI_TEST_EQUALS(float(depthLayout->GetItemTiltAngle()), 5.0f, 0.001f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetColumnPositionFunction(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the column position function
+ depthLayout->SetColumnPositionFunction(DepthLayoutColumnPositionFunction);
+
+ // Check whether we get the correct column position function
+ DALI_TEST_CHECK(depthLayout->GetColumnPositionFunction() == DepthLayoutColumnPositionFunction);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetScrollSpeedFactor(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the scroll speed factor
+ depthLayout->SetScrollSpeedFactor(0.05f);
+
+ // Check whether we get the correct scroll speed factor
+ DALI_TEST_EQUALS(depthLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the maximum swipe speed
+ depthLayout->SetMaximumSwipeSpeed(50.0f);
+
+ // Check whether we get the correct maximum swipe speed
+ DALI_TEST_EQUALS(depthLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the flick animaiton duration
+ depthLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( depthLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutConstraintLeft(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutConstraintRight(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutConstraintUp(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutConstraintDown(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutGetScrollToPosition(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr layout = DepthLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view.
+ std::vector<unsigned int> indices;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ indices.push_back(i);
+ }
+ }
+
+ try
+ {
+ if (!indices.empty())
+ {
+ const unsigned int firstTargetIndex = indices[indices.size()-1];
+ // scroll to last item
+ view.ScrollToItem(firstTargetIndex, 0.00f);
+ application.Render(16); // 60hz frames
+
+ std::size_t moveCount = 0;
+ for(std::size_t i = 0; i < indices.size(); i++)
+ {
+ float layoutPosBefore = view.GetCurrentLayoutPosition(i);
+ view.ScrollToItem(indices[i], 0.0f);
+
+ application.Render(16); // 60hz frame
+
+ float layoutPosAfter = view.GetCurrentLayoutPosition(i);
+
+ if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
+ {
+ ++moveCount;
+ }
+ }
+
+ DALI_TEST_CHECK((moveCount == indices.size()));
+ }
+ }
+ catch(...)
+ {
+ tet_result(TET_FAIL);
+ }
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliDepthLayoutScrollDirection(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ ItemLayoutPtr layout = navigationLayout;
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ navigationLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ Degree deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 180.0f);
+
+ navigationLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK((deg == 0.0f));
+
+ layout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 270.0f);
+
+ navigationLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 90.0f);
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
+} // namespace
+
+
+void utc_displacement_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_displacement_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+// Negative test case for a method
+int UtcDaliDisplacementEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliDisplacementEffectUninitialized");
+
+ Toolkit::DisplacementEffect effect;
+
+ try
+ {
+ // New() must be called to create a GaussianBlurView or it wont be valid.
+ effect.SetStateProperty( 1.0f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliDisplacementEffectNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliDisplacementEffectNew");
+
+ Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED);
+ DALI_TEST_CHECK( effect );
+
+ Toolkit::DisplacementEffect effect2 = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::FIXED);
+ DALI_TEST_CHECK( effect2 );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliDisplacementEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliDisplacementEffectPropertyNames");
+
+ Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED);
+ DALI_TEST_CHECK( effect );
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetLightDirectionPropertyName(), "uLightDirection", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetAmbientLightColorPropertyName(), "uAmbientLightColor", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetDiffuseLightColorPropertyName(), "uDiffuseLightColor", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetLightingMultiplierPropertyName(), "uLightMultiplier", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetStatePropertyName(), "uState", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetHeightScalePropertyName(), "uHightScale", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetFixedNormalPropertyName(), "uFixedNormal", TEST_LOCATION );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliDisplacementEffectTestSetProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliDisplacementEffectTestSetProperty");
+
+ Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED);
+ DALI_TEST_CHECK( effect );
+
+ ImageActor actor = ImageActor::New( Image::New(TEST_IMAGE_FILE_NAME) );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ Toolkit::DisplacementEffect effect2 = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::FIXED);
+ DALI_TEST_CHECK( effect );
+
+ ImageActor actor2 = ImageActor::New( Image::New(TEST_IMAGE_FILE_NAME) );
+ actor2.SetSize( 100.0f, 100.0f );
+ actor2.SetShaderEffect( effect2 );
+ Stage::GetCurrent().Add( actor2 );
+
+ Vector3 testVector3 = Vector3(45.0f, 55.0f, 65.0f);
+ float testFloat = 0.623f;
+ effect.SetLightDirection(testVector3);
+ effect.SetAmbientLightColorProperty(testVector3);
+ effect.SetDiffuseLightColorProperty(testVector3);
+ effect.SetStateProperty(testFloat);
+ effect.SetLightingMultiplierProperty(testFloat);
+ effect.SetHeightScaleProperty(testFloat);
+
+ effect2.SetFixedNormalProperty(testVector3);
+
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetLightDirectionPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetAmbientLightColorPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetDiffuseLightColorPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetStatePropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetLightingMultiplierPropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetHeightScalePropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
+
+ Vector3 normalizedVector3(testVector3);
+ normalizedVector3.Normalize();
+ DALI_TEST_EQUALS( effect2.GetProperty( effect2.GetPropertyIndex( effect2.GetFixedNormalPropertyName() ) ).Get<Vector3>(), normalizedVector3, TEST_LOCATION );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+void utc_distance_field_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_distance_field_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+// Create bitmap image
+BitmapImage CreateDistanceField()
+{
+ BitmapImage image = BitmapImage::New(256, 256, Pixel::RGBA8888);
+ BitmapImage distanceFieldImage = BitmapImage::New(256, 256, Pixel::L8);
+
+ PixelBuffer* pixbuf = image.GetBuffer();
+
+ for(size_t i=0; i<16; i++)
+ {
+ pixbuf[i*4+0] = 0xFF;
+ pixbuf[i*4+1] = 0xFF;
+ pixbuf[i*4+2] = 0xFF;
+ pixbuf[i*4+3] = 0xFF;
+ }
+
+ // GenerateDistanceFieldMap(distanceFieldImage.GetBuffer(), Size(256, 256), pixbuf, Size(256, 256), 8, 4);
+
+ return distanceFieldImage;
+}
+}
+
+int UtcDaliDistanceFieldEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DistanceFieldEffect effect;
+
+ try
+ {
+ // New() must be called to create a DistanceField effect or it wont be valid.
+ effect.SetShadow( true );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliDistanceFieldEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New();
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetColorPropertyName(), "uColor", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetSmoothingPropertyName(), "uSmoothing", TEST_LOCATION );
+
+ // control flags
+ DALI_TEST_EQUALS( effect.GetOutlineEnablePropertyName(), "uDoOutline", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetGlowEnablePropertyName(), "uDoGlow", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetShadowEnablePropertyName(), "uDoShadow", TEST_LOCATION );
+
+ DALI_TEST_EQUALS( effect.GetGlowBoundaryPropertyName(), "uGlowBoundary", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetGlowColorPropertyName(), "uGlowColor", TEST_LOCATION );
+
+ DALI_TEST_EQUALS( effect.GetOutlineColorPropertyName(), "uOutlineColor", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetOutlineSizePropertyName(), "uOutlineParams", TEST_LOCATION );
+
+ DALI_TEST_EQUALS( effect.GetShadowColorPropertyName(), "uShadowColor", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetShadowOffsetPropertyName(), "uShadowOffset", TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliDistanceFieldEffectDefaultValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateDistanceField();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetOutlineEnablePropertyName().c_str(),
+ 0.0f ));
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetGlowEnablePropertyName().c_str(),
+ 0.0f ));
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetShadowEnablePropertyName().c_str(),
+ 0.0f ));
+ END_TEST;
+}
+
+int UtcDaliDistanceFieldEffectCustomValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateDistanceField();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ effect.SetShadowColor(Color::YELLOW);
+ effect.SetGlowColor(Color::BLUE);
+
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetShadowColorPropertyName().c_str(),
+ Color::YELLOW ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetGlowColorPropertyName().c_str(),
+ Color::BLUE ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
+} // namespace
+
+void utc_gaussian_blur_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_gaussian_blur_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+
+// Negative test case for a method
+int UtcDaliGaussianBlurViewUninitialized(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewUninitialized");
+
+ Toolkit::GaussianBlurView view;
+
+ try
+ {
+ // New() must be called to create a GaussianBlurView or it wont be valid.
+ Actor a = Actor::New();
+ view.Add( a );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!view);
+ }
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliGaussianBlurViewNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewNew");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New();
+ DALI_TEST_CHECK( view );
+
+ Toolkit::GaussianBlurView view2 = Toolkit::GaussianBlurView::New(5, 1.5f, Pixel::RGB888, 0.5f, 0.5f, false);
+ DALI_TEST_CHECK( view2 );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliGaussianBlurViewDownCast(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewDownCast");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New();
+ BaseHandle handle(view);
+
+ Toolkit::GaussianBlurView gaussianBlurView = Toolkit::GaussianBlurView::DownCast( handle );
+ DALI_TEST_CHECK( view );
+ DALI_TEST_CHECK( gaussianBlurView );
+ DALI_TEST_CHECK( gaussianBlurView == view );
+ END_TEST;
+}
+
+
+// Positive test case for a method
+int UtcDaliGaussianBlurViewPropertyNames(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewPropertyNames");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New();
+ DALI_TEST_CHECK( view );
+
+ // Check the names, this names are used in the shader code,
+ // if they change in the shader code, then it has to be updated here.
+ DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("GaussianBlurStrengthPropertyName"), TEST_LOCATION );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliGaussianBlurViewAddRemove(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewAddRemove");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New();
+ DALI_TEST_CHECK( view );
+
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK( !actor.OnStage() );
+
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(actor);
+ Stage::GetCurrent().Add(view);
+
+ DALI_TEST_CHECK( actor.OnStage() );
+
+ view.Remove(actor);
+
+ DALI_TEST_CHECK( !actor.OnStage() );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliGaussianBlurActivateDeactivate(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurActivateDeactivate");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New();
+ DALI_TEST_CHECK( view );
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(Actor::New());
+ Stage::GetCurrent().Add(view);
+ view.Activate();
+
+ RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
+
+ view.Deactivate();
+
+ RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliGaussianBlurViewSetGetBackgroundColor(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewSetGetBackgroundColor");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New();
+ DALI_TEST_CHECK( view );
+
+ view.SetBackgroundColor(Dali::Color::RED);
+ Vector4 color = view.GetBackgroundColor();
+ DALI_TEST_CHECK( color == Dali::Color::RED );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliGaussianBlurViewSetGetRenderTarget(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewSetGetRenderTarget");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(5, 1.5f, Pixel::RGB888, 0.5f, 0.5f, true);
+ DALI_TEST_CHECK( view );
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(Actor::New());
+ Stage::GetCurrent().Add(view);
+ view.Activate();
+
+ FrameBufferImage renderTarget = FrameBufferImage::New( 480.0f, 800.0f, Pixel::RGB888 );
+ view.SetUserImageAndOutputRenderTarget(Image::New(TEST_IMAGE_FILE_NAME), renderTarget);
+ DALI_TEST_CHECK( view.GetBlurredRenderTarget() == renderTarget );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 100;
+const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
+
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an image actor for this item
+ Image image = Image::New( TEST_IMAGE_FILE_NAME );
+ Actor actor = ImageActor::New(image);
+
+ return actor;
+ }
+};
+
+} // namespace
+
+
+
+int UtcDaliItemViewAddAndGetLayout(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // As we have added one layout, check the number of layout is now 1
+ DALI_TEST_CHECK(view.GetLayoutCount() == 1);
+
+ // Create a depth layout and add it to ItemView
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+ view.AddLayout(*depthLayout);
+
+ // As we have added another layout, check the number of layout is now 2
+ DALI_TEST_CHECK(view.GetLayoutCount() == 2);
+
+ // Create a spiral layout and add it to ItemView
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+ view.AddLayout(*spiralLayout);
+
+ // As we have added another layout, check the number of layout is now 3
+ DALI_TEST_CHECK(view.GetLayoutCount() == 3);
+
+ // Check we are getting the correct layout from ItemView
+ DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
+ DALI_TEST_CHECK(view.GetLayout(1) == depthLayout);
+ DALI_TEST_CHECK(view.GetLayout(2) == spiralLayout);
+ END_TEST;
+}
+
+int UtcDaliItemViewAddAndRemoveLayout(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // As we have added one layout, check the number of layout is now 1
+ DALI_TEST_CHECK(view.GetLayoutCount() == 1);
+
+ // Create a depth layout and add it to ItemView
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+ view.AddLayout(*depthLayout);
+
+ // As we have added another layout, check the number of layout is now 2
+ DALI_TEST_CHECK(view.GetLayoutCount() == 2);
+
+ // Check we are getting the correct layout from ItemView
+ DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
+ DALI_TEST_CHECK(view.GetLayout(1) == depthLayout);
+
+ // Remove the grid layout
+ view.RemoveLayout(0);
+
+ // As we have removed the grid layout, check the number of layout is now 1
+ DALI_TEST_CHECK(view.GetLayoutCount() == 1);
+
+ // Check we are getting the correct layout from ItemView
+ DALI_TEST_CHECK(view.GetLayout(0) == depthLayout);
+
+ // Remove the depth layout
+ view.RemoveLayout(0);
+
+ // As we also removed the depth layout, check the number of layout is now 0
+ DALI_TEST_CHECK(view.GetLayoutCount() == 0);
+ END_TEST;
+}
+
+int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Create a depth layout and add it to ItemView
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+ view.AddLayout(*depthLayout);
+
+ // Create a spiral layout and add it to ItemView
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+ view.AddLayout(*spiralLayout);
+
+ // As we have added three layouts, check the number of layout is now 3
+ DALI_TEST_CHECK(view.GetLayoutCount() == 3);
+
+ // Check there is no active layout at the moment
+ DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
+
+ // Activate the depth layout
+ Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+ view.ActivateLayout(1, stageSize, 0.5f);
+
+ // Check the current active layout is the depth layout
+ DALI_TEST_CHECK(view.GetActiveLayout() == depthLayout);
+
+ // Activate the grid layout
+ view.ActivateLayout(0, stageSize, 0.5f);
+
+ // Check the current active layout is the grid layout
+ DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
+
+ // Activate the spiral layout
+ view.ActivateLayout(2, stageSize, 0.5f);
+
+ // Check the current active layout is the spiral layout
+ DALI_TEST_CHECK(view.GetActiveLayout() == spiralLayout);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/public-api/builder/json-parser.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void utc_json_parser_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_json_parser_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+std::string ReplaceQuotes(const std::string &in_s)
+{
+ std::string s(in_s);
+ // wrong as no embedded quote but had regex link problems
+ std::replace(s.begin(), s.end(), '\'', '"');
+ return s;
+}
+}
+
+
+int UtcDaliJsonParserMethod01(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON basic test");
+
+ std::string s1( ReplaceQuotes(
+"{ \
+ 'string':'value2', \
+ 'integer':2, \
+ 'float':2.0, \
+ 'boolean':true, \
+ 'nil':null, \
+ 'array':[1,2,3], \
+ 'object':{'key':'value'} \
+END_TEST; \
+}"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ const TreeNode* root = parser.GetRoot();
+
+ DALI_TEST_CHECK(root);
+
+ DALI_TEST_CHECK(root->Size());
+
+ TreeNode::ConstIterator iter = root->CBegin();
+ DALI_TEST_CHECK(iter != root->CEnd());
+
+ const TreeNode* node = NULL;
+
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::STRING);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("string"));
+ DALI_TEST_CHECK(std::string(node->GetString()) == std::string("value2"));
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::INTEGER);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("integer"));
+ DALI_TEST_CHECK(node->GetInteger() == 2);
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::FLOAT);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("float"));
+ DALI_TEST_CHECK(node->GetFloat() == 2.0);
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::BOOLEAN);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("boolean"));
+ DALI_TEST_CHECK(node->GetBoolean());
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::IS_NULL);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("nil"));
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::ARRAY);
+ DALI_TEST_CHECK(node->Size() == 3);
+ TreeNode::ConstIterator iterArray = node->CBegin();
+
+ DALI_TEST_CHECK(iterArray != node->CEnd());
+ DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER);
+ DALI_TEST_CHECK( (*iterArray).first == NULL );
+ DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 1);
+
+ ++iterArray;
+ DALI_TEST_CHECK(iterArray != node->CEnd());
+ DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER);
+ DALI_TEST_CHECK( (*iterArray).first == NULL );
+ DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 2);
+
+ ++iterArray;
+ DALI_TEST_CHECK(iterArray != node->CEnd());
+ DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER);
+ DALI_TEST_CHECK( (*iterArray).first == NULL );
+ DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 3);
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::OBJECT);
+ DALI_TEST_CHECK(node->Size() == 1);
+
+ TreeNode::ConstIterator iterObject = node->CBegin();
+ DALI_TEST_CHECK(iterObject != node->CEnd());
+ DALI_TEST_CHECK( ((*iterObject).second).GetType() == TreeNode::STRING);
+ DALI_TEST_CHECK( std::string((*iterObject).first) == std::string("key" ));
+ DALI_TEST_CHECK( std::string(((*iterObject).second).GetString()) == std::string("value"));
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliJsonParserMethod02(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Comments");
+
+ std::string s1( ReplaceQuotes(" \
+// some comments with empty line above \n\
+{ \
+ // inline comments \n\
+ 'key':'value', // endline comments \n\
+ // more inline comments \n\
+ 'key2':'value2' \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ const TreeNode* root = parser.GetRoot();
+
+ DALI_TEST_CHECK(root);
+
+ DALI_TEST_CHECK(root->Size());
+
+ const TreeNode& node = (*root->CBegin()).second;
+
+ DALI_TEST_CHECK(node.GetType() == TreeNode::STRING);
+
+ DALI_TEST_CHECK(node.GetString() == std::string("value"));
+
+ DALI_TEST_CHECK((*root->CBegin()).first == std::string("key"));
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+
+int UtcDaliJsonParserMethod03(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Empty line comment");
+
+ std::string s1( ReplaceQuotes(
+"/*\n" \
+"c comment\n" \
+"*/"\
+"// next empty line comment\n"\
+"//\n"\
+"{\n"\
+" 'key':'value'\n"\
+"}\n"\
+));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ const TreeNode* root = parser.GetRoot();
+
+ DALI_TEST_CHECK(root);
+
+ DALI_TEST_CHECK(root->Size());
+
+ const TreeNode& node = (*root->CBegin()).second;
+
+ DALI_TEST_CHECK(node.GetType() == TreeNode::STRING);
+
+ DALI_TEST_CHECK(node.GetString() == std::string("value"));
+
+ DALI_TEST_CHECK((*root->CBegin()).first == std::string("key"));
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliJsonParserMethod04(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Merge");
+
+ std::string s1( ReplaceQuotes(" \
+{ \
+ 'animations': \
+ { \
+ 'bump': \
+ { \
+ 'properties': \
+ [ \
+ { \
+ 'actor':'bump-image', \
+ 'property':'uLightPosition', \
+ 'value':[0.8, 0.0, -1.5], \
+ 'alpha-function': 'BOUNCE', \
+ 'time-period': { 'duration': 2.5 } \
+ } \
+ ] \
+ } \
+ } \
+} \
+"));
+
+ std::string s2( ReplaceQuotes(" \
+{ \
+ 'animations': \
+ { \
+ 'bump': \
+ { \
+ 'duration': 5.0, \
+ 'loop': true, \
+ 'end-action':'DISCARD' \
+ } \
+ } \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ parser.Parse( s2 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ const TreeNode* root = parser.GetRoot();
+ DALI_TEST_CHECK(root);
+
+ const TreeNode *node = root->Find("bump");
+ DALI_TEST_CHECK(node);
+
+ DALI_TEST_CHECK(static_cast<int>(node->Size()) == 4);
+
+ DALI_TEST_CHECK( node->GetChild("duration") );
+ DALI_TEST_CHECK( node->GetChild("loop") );
+ DALI_TEST_CHECK( node->GetChild("properties") );
+
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliJsonParserMethod05(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Pack & Write");
+
+ std::string s1( ReplaceQuotes(" \
+{ \
+ 'animations': \
+ { \
+ 'bump': \
+ { \
+ 'properties': \
+ [ \
+ { \
+ 'actor':'bump-image', \
+ 'property':'uLightPosition', \
+ 'value':[0.8, 0.0, -1.5], \
+ 'alpha-function': 'BOUNCE', \
+ 'time-period': { 'duration': 2.5 } \
+ } \
+ ] \
+ } \
+ } \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ std::stringstream a;
+ parser.Write(a, 2);
+
+ parser.Pack();
+
+ std::stringstream b;
+ parser.Write(b, 2);
+
+ DALI_TEST_CHECK( a.str() == b.str() );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+namespace
+{
+
+static const int NUMBER_OK_TESTS = 36;
+const char *TEST_OK[NUMBER_OK_TESTS] = {
+ "{ 'hex': '\u0123\u4567\u89AB\uCDEF\uabcd\uef4A' }",
+ "{ 'special': '`1~!@#$%^&*()_+-={:[,]}|;.</>?' }",
+ "{ 'slash': '/ & \' }",
+ "{'object with 1 member':['array with 1 element']}",
+ "[{}, [], -42, true, false, null]",
+ "{ 'integer': 1234567890 }",
+ "{ 'integer': 1234567890 }",
+ "{ 'real': -9876.543210 }",
+ "{ 'e': 0.123456789e-12 }",
+ "{ 'E': 1.234567890E+34 }",
+ "{ '': 23456789012E66 }",
+ "{ 'zero': 0 }",
+ "{ 'one': 1 }",
+ "{ 'space': ' ' }",
+ "{ 'backslash': '\' }",
+ "{ 'controls': '\\b\\f\\n\\r\\t' }",
+ "{ 'alpha': 'abcdefghijklmnopqrstuvwyz' }",
+ "{ 'ALPHA': 'ABCDEFGHIJKLMNOPQRSTUVWYZ' }",
+ "{ 'digit': '0123456789' }",
+ "{ '0123456789': 'digit' }",
+ "{ 'true': true }",
+ "{ 'false': false }",
+ "{ 'null': null }",
+ "{ 'array':[ ] }",
+ "{ 'object':{ } }",
+ "{ 'address': '1 Communication Centre. South Street' }",
+ "{ 'url': 'http://www.JSON.org/' }",
+ "{ 'comment': '// /* <!-- --' }",
+ "{ '# -- --> */': ' ' }",
+ "{ ' s p a c e d ' :[1,2 , 3,4 , 5 , 6 ,7 ]}",
+ "{ 'compact':[1,2,3,4,5,6,7]}",
+ "{ 'quotes': '" \\u0022 %22 0x22 034 "' }",
+ "{ '\\uCAFE\\uBABE\\uAB98\\uFCDE\\ubcda\\uef4A\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:': 'A key can be any string'}",
+ "[ 0.5 ,98.6, 99.44,1066,1e1,0.1e1,1e-1,1e00,2e+00,2e-00, 'rosebud']",
+ "{'JSON Test Pattern pass3': { 'The outermost value': 'must be an object or array.', 'In this test': 'It is an object.' } }",
+ "[[[[[[[[[[[[[[[[[[['Not too deep']]]]]]]]]]]]]]]]]]]",
+};
+}
+
+
+int UtcDaliJsonParserMethod06(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Parse Success");
+
+ JsonParser parser = JsonParser::New();
+
+ for(int i = 0; i < NUMBER_OK_TESTS; ++i)
+ {
+ parser = JsonParser::New();
+
+ parser.Parse( ReplaceQuotes(TEST_OK[i]) );
+
+ if(parser.ParseError())
+ {
+ tet_printf("Valid JSON parse test %d Failed", i);
+ tet_printf("%s", ReplaceQuotes(TEST_OK[i]).c_str());
+
+ tet_printf("JSON Error %d:%d: %s (%d)", parser.GetErrorLineNumber(), parser.GetErrorColumn(), parser.GetErrorDescription().c_str(), parser.GetErrorPosition());
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+namespace
+{
+
+static const int NUMBER_FAIL_TESTS = 32;
+const char *TEST_FAIL[] = {
+ "[' tab\t character \t in\t string ']",
+ "['Extra close']]",
+ "['Colon instead of comma': false]",
+ "{'Numbers cannot have leading zeroes': 013}",
+ "['Bad value', truth]",
+ "['Illegal backslash escape: \017']",
+ "['Bad value', truth]['Illegal backslash escape: \017']",
+ "{'Comma instead if closing brace': true,",
+ "{'Double colon':: null}",
+ "{'Extra comma': true,}",
+ "['Unclosed array'",
+ "{'Illegal invocation': alert()}",
+ "{'Missing colon' null}",
+ "[0e]",
+ "{unquoted_key: 'keys must be quoted'}",
+ "'A JSON payload should be an object or array, not a string.'",
+ "[\naked]",
+ "{'Illegal expression': 1 + 2}",
+ "{'Extra value after close': true} 'misplaced quoted value'",
+ "[0e+]",
+ "[+23456789012E66]",
+ "['extra comma',]",
+ "['Comma after the close'],",
+ "['double extra comma',,]",
+ "['Illegal backslash escape: \x15']",
+ "['line\nbreak']",
+ "{'Comma instead of colon', null}",
+ "['mismatch'}",
+ "['line\nbreak']",
+ "[0e+-1]",
+ "{'Numbers cannot be hex': 0x14}",
+ "[ , '<-- missing value']",
+};
+}
+
+int UtcDaliJsonParserMethod07(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Fail");
+
+ JsonParser parser = JsonParser::New();
+
+ for(int i = 0; i < NUMBER_FAIL_TESTS; ++i)
+ {
+ parser = JsonParser::New();
+
+ parser.Parse( ReplaceQuotes(TEST_FAIL[i]) );
+
+ if(!parser.ParseError())
+ {
+ tet_printf("Invalid JSON parse test %d Failed", i);
+ tet_printf("%s", ReplaceQuotes(TEST_FAIL[i]).c_str());
+ tet_printf("JSON Error %d:%d %s (%s)", parser.GetErrorLineNumber(), parser.GetErrorColumn(),
+ parser.GetErrorDescription().c_str(), parser.GetErrorPosition());
+ }
+
+ DALI_TEST_CHECK(parser.ParseError());
+ }
+
+
+ parser = JsonParser::New();
+
+ parser.Parse( "['single quote']" );
+
+ if(!parser.ParseError())
+ {
+ tet_printf("['single quote']");
+ }
+
+ DALI_TEST_CHECK(parser.ParseError());
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliJsonParserMethod08(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON error reporting");
+
+ std::string s1( ReplaceQuotes("\
+{ \n\
+ 'float':,], \n\
+} \n\
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ DALI_TEST_CHECK(parser.ParseError());
+
+ DALI_TEST_CHECK(1 == parser.GetErrorLineNumber());
+ DALI_TEST_CHECK(53 == parser.GetErrorPosition());
+ DALI_TEST_CHECK(11 == parser.GetErrorColumn());
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliJsonParserMethod09(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Pack()");
+
+ std::string s1( ReplaceQuotes("\
+{ \
+ 'string':'value2', \
+ 'integer':2, \
+ 'float':2.3, \
+ 'boolean':true, \
+ 'nil':null, \
+ 'array':[1,2,3], \
+ 'object':{'key':'value'} \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ std::stringstream ss1;
+ parser.Write(ss1, 2);
+
+ parser.Pack(); // Pack() moves strings
+
+ std::stringstream ss2;
+ parser.Write(ss2, 2);
+
+ DALI_TEST_CHECK(ss1.str() == ss2.str());
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliJsonParserMethod10(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON basic test");
+
+ std::string s1( "" );
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ DALI_TEST_CHECK(parser.ParseError());
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/key-event-integ.h>
+
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+
+/**
+ * Callback class for KeyInputFocusChanged signal.
+ */
+class KeyInputFocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ /**
+ * Constructor
+ * @param[in] gainActor Ref to the actor that should be set as the one that gains key input focus.
+ * @param[in] lostActor Ref to the actor that should be set as the one that loses key input focus.
+ */
+ KeyInputFocusChangedCallback( Control& gainActor, Control& lostActor )
+ : mActorGain( gainActor ),
+ mActorLost( lostActor )
+ {
+ }
+
+ void Callback( Control gainingActor, Control lostActor )
+ {
+ mActorGain = gainingActor;
+ mActorLost = lostActor;
+ }
+
+ Control& mActorGain;
+ Control& mActorLost;
+};
+
+// Stores data that is populated in the callback and will be read by the TET cases
+struct SignalData
+{
+ SignalData()
+ : functorCalled(false)
+ {}
+
+ void Reset()
+ {
+ functorCalled = false;
+
+ receivedKeyEvent.keyModifier = 0;
+ receivedKeyEvent.keyPressedName.clear();
+ receivedKeyEvent.keyPressed.clear();
+
+ }
+
+ bool functorCalled;
+ KeyEvent receivedKeyEvent;
+};
+
+/**
+ * Callback class to test SignalUnhandledKeyEvent signal
+ */
+class SignalUnhandledKeyEventCallback : public Dali::ConnectionTracker
+{
+public:
+ SignalUnhandledKeyEventCallback( SignalData& data ) : mSignalData( data ) { }
+
+ void Callback(const KeyEvent& event)
+ {
+ mSignalData.functorCalled = true;
+ mSignalData.receivedKeyEvent = event;
+ }
+
+ SignalData& mSignalData;
+};
+
+} // namespace
+
+void key_input_focus_manager_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void key_input_focus_manager_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliKeyInputFocusManagerGet(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerGet");
+
+ KeyInputFocusManager manager;
+ {
+ manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+ }
+
+ KeyInputFocusManager newManager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(newManager);
+
+ // Check that focus manager is a singleton
+ DALI_TEST_CHECK(manager == newManager);
+ END_TEST;
+}
+
+int UtcDaliKeyInputFocusManagerSetFocus(void)
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerSetFocus");
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ PushButton pushButton1 = PushButton::New();
+ stage.Add( pushButton1 );
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1.HasKeyInputFocus());
+ END_TEST;
+}
+
+int UtcDaliKeyInputFocusManagerGetCurrentFocusControl(void)
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerGetCurrentFocusControl");
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ PushButton pushButton1 = PushButton::New();
+ PushButton pushButton2 = PushButton::New();
+ stage.Add( pushButton1 );
+ stage.Add( pushButton2 );
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+
+ manager.SetFocus(pushButton2);
+ DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl());
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+ END_TEST;
+}
+
+int UtcDaliKeyInputFocusManagerRemoveFocus(void)
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerRemoveFocus");
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ PushButton pushButton1 = PushButton::New();
+ PushButton pushButton2 = PushButton::New();
+ stage.Add( pushButton1 );
+ stage.Add( pushButton2 );
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+
+ manager.SetFocus(pushButton2);
+ DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl());
+
+ manager.RemoveFocus(pushButton2);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+
+ manager.RemoveFocus(pushButton1);
+ DALI_TEST_CHECK(Control() == manager.GetCurrentFocusControl());
+ END_TEST;
+}
+
+int UtcDaliKeyInputFocusManagerIsKeyboardListener(void)
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerIsKeyboardListener");
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ PushButton pushButton1 = PushButton::New();
+ PushButton pushButton2 = PushButton::New();
+ stage.Add( pushButton1 );
+ stage.Add( pushButton2 );
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+
+ manager.SetFocus(pushButton2);
+ DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl());
+
+ DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton1));
+ DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton2));
+
+ manager.RemoveFocus(pushButton2);
+ DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton2));
+
+ manager.RemoveFocus(pushButton1);
+ DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton1));
+
+ manager.SetFocus(pushButton2);
+ DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton2));
+ pushButton2.ClearKeyInputFocus();
+ DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton2));
+ END_TEST;
+}
+
+int UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged(void)
+{
+ ToolkitTestApplication application;
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged");
+
+ PushButton pushButton1 = PushButton::New();
+ PushButton pushButton2 = PushButton::New();
+
+ stage.Add( pushButton1 );
+ stage.Add( pushButton2 );
+
+ PushButton gainActor, lostActor;
+ KeyInputFocusChangedCallback callback( gainActor, lostActor );
+ manager.KeyInputFocusChangedSignal().Connect( &callback, &KeyInputFocusChangedCallback::Callback );
+
+ manager.SetFocus(pushButton1);
+
+ DALI_TEST_CHECK( gainActor == pushButton1 );
+ DALI_TEST_CHECK( lostActor == Control() );
+
+ gainActor = lostActor = NULL;
+
+ manager.SetFocus(pushButton2);
+
+ DALI_TEST_CHECK( gainActor == pushButton2 );
+ DALI_TEST_CHECK( lostActor == pushButton1 );
+
+ gainActor = lostActor = NULL;
+
+ // Removing the focus actor from the stage would also result in signal emission.
+ stage.Remove( pushButton1 );
+ stage.Remove( pushButton2 );
+
+ DALI_TEST_CHECK( gainActor == Control() );
+ DALI_TEST_CHECK( lostActor == Control() );
+ END_TEST;
+}
+
+int UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent");
+
+ SignalData data;
+ SignalUnhandledKeyEventCallback callback( data );
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ manager.UnhandledKeyEventSignal().Connect( &callback, &SignalUnhandledKeyEventCallback::Callback );
+
+
+ Integration::KeyEvent event("a", "a", 0, 0, 0, Integration::KeyEvent::Up);
+ application.ProcessEvent(event);
+
+ DALI_TEST_CHECK(data.functorCalled);
+ DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.keyPressedName );
+ DALI_TEST_CHECK(event.keyCode == data.receivedKeyEvent.keyCode);
+ DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.keyPressed );
+ DALI_TEST_CHECK(event.state == data.receivedKeyEvent.state );
+
+ data.Reset();
+
+ Integration::KeyEvent event2("v", "v", 0, 0, 0, Integration::KeyEvent::Up);
+ application.ProcessEvent(event2);
+
+ DALI_TEST_CHECK(data.functorCalled);
+ DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.keyPressedName );
+ DALI_TEST_CHECK(event2.keyCode == data.receivedKeyEvent.keyCode);
+ DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.keyPressed );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/key-event-integ.h>
+
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void dali_keyboard_focus_manager_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_keyboard_focus_manager_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+// Functors to test whether PreFocusChange signal is emitted when the keyboard focus is about to change
+class PreFocusChangeCallback : public Dali::ConnectionTracker
+{
+public:
+ PreFocusChangeCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mProposedActorToFocus(),
+ mDirection(Control::Left)
+ {
+ }
+
+ Actor Callback(Actor currentFocusedActor, Actor proposedActorToFocus, Control::KeyboardFocusNavigationDirection direction)
+ {
+ tet_infoline("Verifying PreFocusChangeCallback()");
+
+ mSignalVerified = true;
+
+ mCurrentFocusedActor = currentFocusedActor;
+ mProposedActorToFocus = proposedActorToFocus;
+ mDirection = direction;
+
+ return mProposedActorToFocus;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ mCurrentFocusedActor = Actor();
+ mProposedActorToFocus = Actor();
+ mDirection = Control::Left;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ Actor mProposedActorToFocus;
+ Control::KeyboardFocusNavigationDirection mDirection;
+};
+
+// Functors to test whether focus changed signal is emitted when the keyboard focus is changed
+class FocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mOriginalFocusedActor(),
+ mCurrentFocusedActor()
+ {
+ }
+
+ void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
+ {
+ tet_infoline("Verifying FocusChangedCallback()");
+
+ if(originalFocusedActor == mCurrentFocusedActor)
+ {
+ mSignalVerified = true;
+ }
+
+ mOriginalFocusedActor = originalFocusedActor;
+ mCurrentFocusedActor = currentFocusedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mOriginalFocusedActor;
+ Actor mCurrentFocusedActor;
+};
+
+// Functors to test whether focus group changed signal is emitted when the keyboard focus group is changed
+class FocusGroupChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusGroupChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mForward(true)
+ {
+ }
+
+ void Callback(Actor currentFocusedActor, bool forward)
+ {
+ tet_infoline("Verifying FocusGroupChangedCallback()");
+
+ mSignalVerified = true;
+
+ mCurrentFocusedActor = currentFocusedActor;
+ mForward = forward;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ bool mForward;
+};
+
+// Functors to test whether focused actor activated signal is emitted when the focused actor is activated
+class FocusedActorActivatedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusedActorActivatedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mActivatedActor()
+ {
+ }
+
+ void Callback(Actor activatedActor)
+ {
+ tet_infoline("Verifying FocusedActorActivatedCallback()");
+
+ mSignalVerified = true;
+
+ mActivatedActor = activatedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mActivatedActor;
+};
+
+} // namespace
+
+
+
+int UtcDaliKeyboardFocusManagerGet(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardKeyboardFocusManagerGet");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager;
+
+ manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ KeyboardFocusManager newManager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(newManager);
+
+ // Check that focus manager is a singleton
+ DALI_TEST_CHECK(manager == newManager);
+ END_TEST;
+}
+
+
+
+int UtcDaliKeyboardFocusManagerMoveFocus(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocus");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool preFocusChangeSignalVerified = false;
+ PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified);
+ manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
+
+ bool focusChangedSignalVerified = false;
+ FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
+ manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ first.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ second.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(second);
+
+ // Move the focus to the right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false);
+
+ // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right);
+ preFocusChangeCallback.Reset();
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false);
+
+ // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right);
+ preFocusChangeCallback.Reset();
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards up
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Up) == false);
+
+ // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Up);
+ preFocusChangeCallback.Reset();
+ DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
+
+ // Create a 2x2 table view and try to move focus inside it
+ TableView tableView = TableView::New( 2, 2 );
+ Stage::GetCurrent().Add(tableView);
+
+ // Create the third actor
+ Actor third = Actor::New();
+ third.SetKeyboardFocusable(true);
+
+ // Create the fourth actor
+ Actor fourth = Actor::New();
+ fourth.SetKeyboardFocusable(true);
+
+ // Add the four children to table view
+ tableView.AddChild(first, TableView::CellPosition(0, 0));
+ tableView.AddChild(second, TableView::CellPosition(0, 1));
+ tableView.AddChild(third, TableView::CellPosition(1, 0));
+ tableView.AddChild(fourth, TableView::CellPosition(1, 1));
+
+ // Set the focus to the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards down
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Down) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards left
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards up
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Up) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards left. The focus move will fail as no way to move it upwards
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Left);
+ preFocusChangeCallback.Reset();
+ DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
+
+ // Enable the loop
+ manager.SetFocusGroupLoop(true);
+ DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
+
+ // Move the focus towards left again. The focus should move to the fourth actor.
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
+ focusChangedCallback.Reset();
+ END_TEST;
+}
+
+
+int UtcDaliKeyboardFocusManagerSignalFocusGroupChanged(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusGroupChanged");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool focusGroupChangedSignalVerified = false;
+ FocusGroupChangedCallback focusGroupChangedCallback(focusGroupChangedSignalVerified);
+ manager.FocusGroupChangedSignal().Connect( &focusGroupChangedCallback, &FocusGroupChangedCallback::Callback );
+
+ Integration::KeyEvent tabEvent("Tab", "", 0, 0, 0, Integration::KeyEvent::Down);
+ Integration::KeyEvent shiftTabEvent("Tab", "", 1, 0, 0, Integration::KeyEvent::Down);
+
+ // Send the tab event to change focus group in the forward direction
+ application.ProcessEvent(tabEvent);
+ DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(focusGroupChangedCallback.mForward == true);
+ focusGroupChangedCallback.Reset();
+
+ // Send the shift tab event to change focus group in the backward direction
+ application.ProcessEvent(shiftTabEvent);
+ DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(focusGroupChangedCallback.mForward == false);
+ focusGroupChangedCallback.Reset();
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+}
+
+
+void navigation_control_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void navigation_control_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliNavigationControlNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliNavigationControlNew");
+
+ NavigationControl naviControl;
+ // Check that this handle is uninitialized
+ DALI_TEST_CHECK( !naviControl );
+
+ naviControl = NavigationControl::New();
+ // Check that the Dali resource is successfully created
+ DALI_TEST_CHECK( naviControl );
+
+ NavigationControl naviControl2( naviControl );
+ DALI_TEST_CHECK( naviControl2 == naviControl );
+
+ //Additional check to ensure object is created by checking whether it is registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( TestCallback );
+ {
+ NavigationControl naviControl = NavigationControl::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliNavigationControlDownCast(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlDownCast" );
+
+ NavigationControl naviControl = NavigationControl::New();
+ BaseHandle handle( naviControl );
+
+ NavigationControl newNaviControl = NavigationControl::DownCast( handle );
+ DALI_TEST_CHECK( naviControl );
+ DALI_TEST_CHECK( newNaviControl == naviControl );
+ END_TEST;
+}
+
+int UtcDaliNavigationControlPushItem(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlPushItem" );
+
+ // Create a NavigationControl object, and add it to stage
+ NavigationControl naviControl = NavigationControl::New();
+ Stage::GetCurrent().Add(naviControl);
+ // Check there is no item in the stack
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 0 );
+
+ // Create two NavigationItem objects
+ Page firstItem = Page::New();
+ Page secondItem = Page::New();
+
+ // Push the first item into stack
+ naviControl.PushItem( firstItem );
+ // Check the item count in stack
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 1 );
+ // Check the current item
+ DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem );
+ // Check that the newly pushed item is displayed on stage
+ DALI_TEST_CHECK( firstItem.OnStage() );
+
+ // Push the second item into stack
+ naviControl.PushItem( secondItem );
+ // Check the item count in stack
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 2 );
+ // Check the current item
+ DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem );
+ // Check the bottom item in the stack
+ DALI_TEST_CHECK( naviControl.GetItem(0) == firstItem );
+ // Check that the previous item is off stage
+ DALI_TEST_CHECK( !firstItem.OnStage() );
+ // Check that the newly pushed item is displayed on stage
+ DALI_TEST_CHECK( secondItem.OnStage() );
+
+ Page thirdItem;
+ Page fourthItem(secondItem);
+ naviControl.PushItem( thirdItem );
+ // Check that an uninitialized item cannot be pushed into the stack
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 2 );
+ naviControl.PushItem( fourthItem );
+ // Check that an duplicated item with the current item cannot be pushed into the stack
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 2 );
+ // Check that the current item and the item on the stage is still the secondItem
+ DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem );
+ DALI_TEST_CHECK( secondItem.OnStage() );
+ END_TEST;
+}
+
+int UtcDaliNavigationControlPopItem(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlPopItem" );
+
+ // Create a NavigationControl object, and add it to stage
+ NavigationControl naviControl = NavigationControl::New();
+ Stage::GetCurrent().Add(naviControl);
+ // Create three NavigationItem objects
+ Page firstItem = Page::New();
+ Page secondItem = Page::New();
+ Page thirdItem = Page::New();
+ naviControl.PushItem( firstItem );
+ naviControl.PushItem( secondItem );
+ naviControl.PushItem( thirdItem );
+
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 3 );
+
+ // pop an item out from the stack
+ Page poppedItem = naviControl.PopItem();
+ // check that the item count is decrease by one
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 2 );
+ // check that the item popped out is the thirdItem
+ DALI_TEST_CHECK( poppedItem == thirdItem );
+ // check that the item popped out is disappeared from the stage
+ DALI_TEST_CHECK( !poppedItem.OnStage() );
+ // check that the new top item is displayed on the stage
+ DALI_TEST_CHECK( secondItem.OnStage() );
+
+ // repeat the above steps again
+ poppedItem = naviControl.PopItem();
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 1 );
+ DALI_TEST_CHECK( poppedItem == secondItem );
+ DALI_TEST_CHECK( !poppedItem.OnStage() );
+ DALI_TEST_CHECK( firstItem.OnStage() );
+
+ // check that the bottom-most item can not be popped out from the stack
+ poppedItem = naviControl.PopItem();
+ // when trying to pop the bottom-most item, it returns an uninitialized handle and does nothing else
+ DALI_TEST_CHECK( !poppedItem );
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 1 );
+ DALI_TEST_CHECK( firstItem.OnStage() );
+ END_TEST;
+}
+
+int UtcDaliNavigationControlGetItemCount(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlGetItemCount" );
+
+ // Create a NavigationControl object
+ NavigationControl naviControl = NavigationControl::New();
+ // Create three NavigationItem objects
+ Page firstItem = Page::New();
+ Page secondItem = Page::New();
+ Page thirdItem = Page::New();
+
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 0 );
+ naviControl.PushItem( firstItem );
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 1 );
+ naviControl.PushItem( secondItem );
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 2 );
+ naviControl.PushItem( thirdItem );
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 3 );
+ naviControl.PopItem();
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 2 );
+ naviControl.PopItem();
+ DALI_TEST_CHECK( naviControl.GetItemCount() == 1 );
+ END_TEST;
+}
+
+int UtcDaliNavigationControlGetItem(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlGetItem" );
+
+ // Create a NavigationControl object
+ NavigationControl naviControl = NavigationControl::New();
+ // Create three NavigationItem objects and push them into stack
+ Page firstItem = Page::New();
+ Page secondItem = Page::New();
+ Page thirdItem = Page::New();
+ naviControl.PushItem( firstItem );
+ naviControl.PushItem( secondItem );
+ naviControl.PushItem( thirdItem );
+
+ // check every item by get it by index
+ DALI_TEST_CHECK( naviControl.GetItem(0) == firstItem );
+ DALI_TEST_CHECK( naviControl.GetItem(1) == secondItem );
+ DALI_TEST_CHECK( naviControl.GetItem(2) == thirdItem);
+ END_TEST;
+}
+
+int UtcDaliNavigationControlGetCurrentItem(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlGetCurrentItem" );
+
+ // Create a NavigationControl object
+ NavigationControl naviControl = NavigationControl::New();
+ // Create three NavigationItem objects
+ Page firstItem = Page::New();
+ Page secondItem = Page::New();
+ Page thirdItem = Page::New();
+
+ naviControl.PushItem( firstItem );
+ DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem );
+ naviControl.PushItem( secondItem );
+ DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem );
+ naviControl.PushItem( thirdItem );
+ DALI_TEST_CHECK( naviControl.GetCurrentItem() == thirdItem );
+ naviControl.PopItem();
+ DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem );
+ naviControl.PopItem();
+ DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem );
+ END_TEST;
+}
+
+int UtcDaliNavigationControlSetBackground(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlSetBackground" );
+
+ try
+ {
+ NavigationControl naviControl = NavigationControl::New();
+ Stage::GetCurrent().Add( naviControl );
+
+ ImageActor background = CreateSolidColorActor( Color::RED );
+ naviControl.SetBackground( background );
+ }
+ catch (Dali::DaliException& e)
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION);
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliNavigationControlCreateNavigationToolBar(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlCreateNavigationToolBar" );
+
+ ImageActor background = CreateSolidColorActor( Color::RED );
+ Stage stage = Stage::GetCurrent();
+
+ NavigationControl naviControl = NavigationControl::New();
+ stage.Add( naviControl );
+
+ Toolkit::NaviToolBarStyle toolbarStyle( background, 720, 98, 496, 182, 72, 16, 63, 26);
+
+ naviControl.CreateNavigationToolBar( toolbarStyle, toolbarStyle);
+
+ Page naviItem = Page::New();
+ PushButton firstControl = PushButton::New();
+ naviItem.AddControlToToolBar(firstControl, Alignment::HorizontalLeft);
+ PushButton secondControl = PushButton::New();
+ naviItem.AddControlToToolBar(secondControl, Alignment::HorizontalCenter);
+ PushButton thirdControl = PushButton::New();
+ naviItem.AddControlToToolBar(thirdControl, Alignment::HorizontalCenter);
+ PushButton fourthControl = PushButton::New();
+ naviItem.AddControlToToolBar(fourthControl, Alignment::HorizontalRight);
+ PushButton fifthControl = PushButton::New();
+ naviItem.AddControlToToolBar(fifthControl, Alignment::HorizontalRight);
+
+ naviControl.PushItem( naviItem );
+
+ DALI_TEST_CHECK( firstControl.OnStage() );
+ // Can add multiple controls to the central group
+ DALI_TEST_CHECK( secondControl.OnStage() );
+ DALI_TEST_CHECK( thirdControl.OnStage() );
+ // Can only have one control in the side groups
+ DALI_TEST_CHECK( !fourthControl.OnStage() );
+ DALI_TEST_CHECK( fifthControl.OnStage() );
+
+ END_TEST;
+}
+
+int UtcDaliNavigationControlCreateNavigationTitleBar(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliNavigationControlCreateNavigationTitleBar" );
+
+ ImageActor background = CreateSolidColorActor( Color::RED );
+ TextStyle textStyle;
+ Stage stage = Stage::GetCurrent();
+
+ NavigationControl naviControl = NavigationControl::New();
+ stage.Add( naviControl );
+
+ Toolkit::NaviTitleBarStyle titleBarStyle( background, textStyle, textStyle, 720, 111, 68, 48, 34, 16, 11, 45, 63, 26, 14, 22 );
+ naviControl.CreateNavigationTitleBar( titleBarStyle, titleBarStyle );
+
+ Page naviItem = Page::New();
+
+ PushButton firstControl = PushButton::New();
+ naviItem.AddControlToTitleBar( firstControl );
+ PushButton secondControl = PushButton::New();
+ naviItem.AddControlToTitleBar( secondControl );
+
+ Actor titleIcon = Actor::New();
+ naviItem.SetTitleIcon( titleIcon );
+
+ naviControl.PushItem( naviItem );
+
+ DALI_TEST_CHECK( firstControl.OnStage() );
+ DALI_TEST_CHECK( secondControl.OnStage() );
+ DALI_TEST_CHECK( titleIcon.OnStage() );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 200;
+
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an test actor for this item
+ ImageActor actor = CreateSolidColorActor(Color::RED);
+ actor.SetSize(64.0f, 64.0f);
+
+ return actor;
+ }
+};
+} // namespace
+
+
+// Positive test case for a method
+int UtcDaliNavigationLayoutNew(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a navigation layout
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+ DALI_TEST_CHECK(navigationLayout);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutColumns(void)
+{
+ ToolkitTestApplication application;
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+
+ navigationLayout->SetNumberOfColumns(6);
+ // Check whether we get the correct number of columns
+ DALI_TEST_CHECK(navigationLayout->GetNumberOfColumns() == 6);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutSetGetOrientation(void)
+{
+ ToolkitTestApplication application;
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+
+ navigationLayout->SetNumberOfColumns(6);
+ navigationLayout->SetOrientation(ControlOrientation::Right);
+ DALI_TEST_CHECK(navigationLayout->GetOrientation() == ControlOrientation::Right);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutTestConstraintLeft(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and all of them is positioned at X = 0
+ // and the series is monotonely decreasing.
+ int nonZeroXCount = 0;
+ int elementsFound = 0;
+ int wrongDirectionCount = 0;
+ float prevY = FLT_MAX;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.x != 0.0f)
+ {
+ nonZeroXCount++;
+ }
+
+ if (pos.y >= prevY)
+ {
+ wrongDirectionCount++;
+ }
+
+ prevY = pos.y;
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroXCount == 0) && (wrongDirectionCount == 0));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutTestConstraintRight(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and all of them is positioned at X = 0
+ // and the series is monotonely increasing.
+ int nonZeroXCount = 0;
+ int elementsFound = 0;
+ int wrongDirectionCount = 0;
+ float prevY = -FLT_MAX;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.x != 0.0f)
+ {
+ nonZeroXCount++;
+ }
+
+ if (pos.y <= prevY)
+ {
+ wrongDirectionCount++;
+ }
+
+ prevY = pos.y;
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroXCount == 0) && (wrongDirectionCount == 0));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutTestConstraintUp(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and all of them is positioned at X = 0
+ // and the series is monotonely decreasing.
+ int nonZeroYCount = 0;
+ int elementsFound = 0;
+ int wrongDirectionCount = 0;
+ float prevX = -FLT_MAX;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.y != 0.0f)
+ {
+ nonZeroYCount++;
+ }
+
+ if (pos.x <= prevX)
+ {
+ wrongDirectionCount++;
+ }
+
+ prevX = pos.x;
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroYCount == 0) && (wrongDirectionCount == 0));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutTestConstraintDown(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and all of them is positioned at X = 0
+ // and the series is monotonely decreasing.
+ int nonZeroYCount = 0;
+ int elementsFound = 0;
+ int wrongDirectionCount = 0;
+ float prevX = FLT_MAX;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.y != 0.0f)
+ {
+ nonZeroYCount++;
+ }
+
+ if (pos.x > prevX)
+ {
+ wrongDirectionCount++;
+ }
+
+ prevX = pos.x;
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroYCount == 0) && (wrongDirectionCount == 0));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+
+int UtcDaliNavigationLayoutScrollDirection(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ ItemLayoutPtr layout = navigationLayout;
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ navigationLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ Degree deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == (180.0f - 45.0f));
+
+ navigationLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK((deg == -45.0f));
+
+ layout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == (270.0f - 45.0f));
+
+ navigationLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == (90.0f - 45.0f));
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutSetGetColumnSpacing(void)
+{
+ ToolkitTestApplication application;
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ const float testValue = 11.0f;
+
+ navigationLayout->SetNumberOfColumns(6);
+ navigationLayout->SetColumnSpacing(testValue);
+ DALI_TEST_CHECK(navigationLayout->GetColumnSpacing() == testValue);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutSetGetTopMargin(void)
+{
+ ToolkitTestApplication application;
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ const float testValue = 11.0f;
+
+ navigationLayout->SetNumberOfColumns(6);
+ navigationLayout->SetTopMargin(testValue);
+ DALI_TEST_CHECK(navigationLayout->GetTopMargin() == testValue);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutSetGetBottomMargin(void)
+{
+ ToolkitTestApplication application;
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ const float testValue = 12.0f;
+
+ navigationLayout->SetNumberOfColumns(6);
+ navigationLayout->SetBottomMargin(testValue);
+ DALI_TEST_CHECK(navigationLayout->GetBottomMargin() == testValue);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutSetGetScrollSpeedFactor(void)
+{
+ ToolkitTestApplication application;
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ const float testValue = 15.0f;
+
+ navigationLayout->SetNumberOfColumns(6);
+ navigationLayout->SetScrollSpeedFactor(testValue);
+ DALI_TEST_CHECK(navigationLayout->GetScrollSpeedFactor() == testValue);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed(void)
+{
+ ToolkitTestApplication application;
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+ const float testValue = 10.0f;
+
+ navigationLayout->SetNumberOfColumns(6);
+ navigationLayout->SetMaximumSwipeSpeed(testValue);
+ DALI_TEST_CHECK(navigationLayout->GetMaximumSwipeSpeed() == testValue);
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a navigation layout
+ NavigationLayoutPtr navigationLayout = NavigationLayout::New();
+
+ // Set the flick animaiton duration
+ navigationLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( navigationLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliNavigationLayoutGetScrollToPosition(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ NavigationLayoutPtr layout = NavigationLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view.
+ std::vector<unsigned int> indices;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ indices.push_back(i);
+ }
+ }
+
+ try
+ {
+ if (!indices.empty())
+ {
+ const unsigned int firstTargetIndex = indices[indices.size()-1];
+ // scroll to last item
+ view.ScrollToItem(firstTargetIndex, 0.00f);
+ application.Render(16); // 60hz frames
+
+ std::size_t moveCount = 0;
+ for(std::size_t i = 0; i < indices.size(); i++)
+ {
+ float layoutPosBefore = view.GetCurrentLayoutPosition(i);
+ view.ScrollToItem(indices[i], 0.0f);
+
+ application.Render(16); // 60hz frame
+
+ float layoutPosAfter = view.GetCurrentLayoutPosition(i);
+
+ if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
+ {
+ ++moveCount;
+ }
+ }
+
+ DALI_TEST_CHECK((moveCount == indices.size()));
+ }
+ }
+ catch(...)
+ {
+ tet_result(TET_FAIL);
+ }
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void overlay_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void overlay_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliOverlayConstructor(void)
+{
+ ToolkitTestApplication application;
+
+ BitmapImage image = CreateBitmapImage();
+
+ Toolkit::OverlayEffect effect = Toolkit::OverlayEffect::New( image );
+ DALI_TEST_CHECK( effect );
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
+int UtcDaliOverlayUninitializedEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::OverlayEffect effect;
+
+ try
+ {
+ BitmapImage image = CreateBitmapImage();
+
+ // New() must be called to create a OverlayEffect or it wont be valid.
+ effect.SetEffectImage( image );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void dali_page_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_page_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+}
+
+
+
+int UtcDaliPageNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliPageNew");
+
+ Page naviItem;
+ // Check that this handle is uninitialized
+ DALI_TEST_CHECK( !naviItem );
+
+ naviItem = Page::New();
+ // Check that the Dali resource is successfully created
+ DALI_TEST_CHECK( naviItem );
+
+ Page naviItem2( naviItem );
+ DALI_TEST_CHECK( naviItem2 == naviItem );
+
+ // Additional check to ensure the object is created by checking whether it is registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( TestCallback );
+ {
+ Page naviItem = Page::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliPageDownCast(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliPageDownCast" );
+
+ Page naviItem = Page::New();
+ BaseHandle handle( naviItem );
+
+ Page newNaviItem = Page::DownCast( handle );
+ DALI_TEST_CHECK( naviItem );
+ DALI_TEST_CHECK( newNaviItem == naviItem );
+ END_TEST;
+}
+
+int UtcDaliPageSetGetTitle(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliPageSetGetTitle" );
+
+ Page naviItem = Page::New();
+ DALI_TEST_CHECK( naviItem.GetTitle().empty() );
+
+ std::string str( "ItemTitle" );
+ naviItem.SetTitle( str );
+ DALI_TEST_CHECK( naviItem.GetTitle() == str );
+ END_TEST;
+}
+
+int UtcDaliPageSetGetSubTitle(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliPageSetGetSubTitle" );
+
+ Page naviItem = Page::New();
+ DALI_TEST_CHECK( naviItem.GetSubTitle().empty() );
+
+ std::string str( "ItemSubTitle" );
+ naviItem.SetSubTitle( str );
+ DALI_TEST_CHECK( naviItem.GetSubTitle() == str );
+ END_TEST;
+}
+
+int UtcDaliPageSetGetTitleIcon(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliPageSetGetTitleIcon" );
+
+ Page naviItem = Page::New();
+ DALI_TEST_CHECK( !naviItem.GetTitleIcon() );
+
+ Actor titleIcon = Actor::New();
+ naviItem.SetTitleIcon( titleIcon );
+ DALI_TEST_CHECK( naviItem.GetTitleIcon() == titleIcon );
+ END_TEST;
+}
+
+int UtcDaliPageAddGetToolBarControl(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliPageAddGetToolBarControl" );
+
+ Page naviItem = Page::New();
+ Page::ControlOnBarContainer container = naviItem.GetControlsOnToolBar();
+ // Check that the container is empty in the beginning
+ DALI_TEST_CHECK( container.empty() );
+
+ // Add control, check whether adding successfully, also check the container size
+ PushButton firstControl = PushButton::New();
+ DALI_TEST_CHECK( naviItem.AddControlToToolBar(firstControl, Alignment::HorizontalLeft) );
+ container = naviItem.GetControlsOnToolBar();
+ DALI_TEST_CHECK( container.size() == 1 );
+
+ // Add control, check whether adding successfully, also check the container size
+ PushButton secondControl = PushButton::New();
+ DALI_TEST_CHECK( naviItem.AddControlToToolBar(secondControl, Alignment::HorizontalCenter) );
+ container = naviItem.GetControlsOnToolBar();
+ DALI_TEST_CHECK( container.size() == 2 );
+
+ // The control adding fails, as the alignment is not HorizontalLeft/HorizontalCenter/HorizontalRight
+ PushButton thirdControl = PushButton::New();
+ DALI_TEST_CHECK( !naviItem.AddControlToToolBar(thirdControl, Alignment::VerticalCenter) );
+ container = naviItem.GetControlsOnToolBar();
+ DALI_TEST_CHECK( container.size() == 2 );
+
+ // Add control, check whether adding successfully, also check the container size
+ PushButton fourthControl = PushButton::New();
+ DALI_TEST_CHECK( naviItem.AddControlToToolBar(fourthControl, Alignment::HorizontalRight) );
+ container = naviItem.GetControlsOnToolBar();
+ DALI_TEST_CHECK( container.size() == 3 );
+
+ // The control adding fails, as the control itself is uninitialized
+ PushButton fifthControl;
+ DALI_TEST_CHECK( !naviItem.AddControlToToolBar(fifthControl, Alignment::HorizontalCenter) );
+ container = naviItem.GetControlsOnToolBar();
+ DALI_TEST_CHECK( container.size() == 3 );
+
+ // check the content of the three successfully added ControlOnBar objects
+ DALI_TEST_CHECK( container[0]->control == firstControl );
+ DALI_TEST_CHECK( container[0]->alignment == Alignment::HorizontalLeft );
+ DALI_TEST_CHECK( container[1]->control == secondControl );
+ DALI_TEST_CHECK( container[1]->alignment == Alignment::HorizontalCenter );
+ DALI_TEST_CHECK( container[2]->control == fourthControl );
+ DALI_TEST_CHECK( container[2]->alignment == Alignment::HorizontalRight );
+ END_TEST;
+}
+
+int UtcDaliPageAddGetTitleBarControl(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliPageAddGetTitleBarControl" );
+
+ Page naviItem = Page::New();
+ ActorContainer container = naviItem.GetControlsOnTitleBar();
+ // Check that the container is empty in the beginning
+ DALI_TEST_CHECK( container.empty() );
+
+ // Add control, check whether adding successfully, also check the container size
+ PushButton firstControl = PushButton::New();
+ DALI_TEST_CHECK( naviItem.AddControlToTitleBar(firstControl) );
+ container = naviItem.GetControlsOnTitleBar();
+ DALI_TEST_CHECK( container.size() == 1 );
+
+ // The control adding fails, as the control itself is uninitialized
+ PushButton secondControl;
+ DALI_TEST_CHECK( !naviItem.AddControlToTitleBar(secondControl) );
+ container = naviItem.GetControlsOnTitleBar();
+ DALI_TEST_CHECK( container.size() == 1 );
+
+ // Add control, check whether adding successfully, also check the container size
+ PushButton thirdControl = PushButton::New();
+ DALI_TEST_CHECK( naviItem.AddControlToTitleBar(thirdControl) );
+ container = naviItem.GetControlsOnTitleBar();
+ DALI_TEST_CHECK( container.size() == 2 );
+
+ // check the content of the three successfully added Controls
+ DALI_TEST_CHECK( container[0] == firstControl );
+ DALI_TEST_CHECK( container[1] == thirdControl );
+ END_TEST;
+}
+
+int UtcDaliPageSetGetPopupMenu(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliPageSetGetPopupMenu" );
+
+ Page naviItem = Page::New();
+ DALI_TEST_CHECK( !naviItem.GetPopupMenu() );
+
+ Toolkit::Popup menu = Toolkit::Popup::New();
+ naviItem.SetPopupMenu( menu );
+ DALI_TEST_CHECK( menu == naviItem.GetPopupMenu() );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+
+void page_turn_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void page_turn_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliPageTurnEffectApply(void)
+{
+ ToolkitTestApplication application;
+
+ BitmapImage image = CreateBitmapImage();
+
+ Toolkit::PageTurnEffect pageTurnEffect = Toolkit::PageTurnEffect::New();
+ Toolkit::PageTurnEffect pageTurnEffect2 = Toolkit::PageTurnEffect::New(false);
+
+ ImageActor pageActor = ImageActor::New( image );
+ ImageActor backPageActor = ImageActor::New( image );
+ pageActor.Add( backPageActor );
+
+ pageTurnEffect.SetIsTurningBack( true );
+ pageTurnEffect.SetShadowWidth( 0.0f );
+ pageTurnEffect.SetSpineShadowParameter( Vector2( 0.0f, 0.0f ) );
+
+ pageActor.SetShaderEffect( pageTurnEffect );
+ Stage::GetCurrent().Add( pageActor );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector2 pageSize( 0.0f, 0.0f );
+ pageTurnEffect.SetPageSize( pageSize );
+
+ const Vector2 originalCenter( 0.0f, 0.0f );
+ pageTurnEffect.SetOriginalCenter( originalCenter );
+
+ const Vector2 currentCenter( 0.0f, 0.0f );
+ pageTurnEffect.SetCurrentCenter( currentCenter );
+
+ application.SendNotification();
+ application.Render();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetPageSizePropertyName().c_str(), pageSize ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetOriginalCenterPropertyName().c_str(), originalCenter ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetCurrentCenterPropertyName().c_str(), currentCenter ) );
+ END_TEST;
+}
+
+int UtcDaliPageTurnEffectConstruct(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::PageTurnEffect* effect = new Toolkit::PageTurnEffect();
+ delete effect;
+
+ DALI_TEST_CHECK( true );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <string.h>
+#include <sstream>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void dali_page_turn_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_page_turn_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+
+namespace
+{
+const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+const unsigned int TOTAL_PAGE_NUMBER = 20;
+const Vector2 PAGE_SIZE( 300.f,400.f );
+const unsigned int IMAGE_WIDTH = 30;
+const unsigned int IMAGE_HEIGHT = 30;
+const Vector2 IMAGE_SIZE( static_cast<float>( IMAGE_WIDTH ), static_cast<float>(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<frames;i++)
+ {
+ pos += direction; // Move in this direction
+ SendPan(application, Gesture::Continuing, pos);
+ Wait(application);
+ }
+
+ if(toFinish)
+ {
+ pos += direction; // Move in this direction
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application);
+ }
+
+ return pos;
+}
+
+
+//Functor to test whether PageTurnSignal / PagePanSignal is emitted
+class PageSignalCallback : public Dali::ConnectionTracker
+{
+public:
+
+ PageSignalCallback( bool& signalReceived, PageTurnView& view, unsigned int& pageIndex, bool& isForwards )
+ : mSignalVerified( signalReceived ),
+ mView( view ),
+ mPageIndex( pageIndex ),
+ mIsTurningForwards( isForwards )
+ {
+ }
+
+ // callback to be connected to PageTurnSignal
+ void PageTurnSignalCallback( PageTurnView view, unsigned int pageIndex, bool isTurningForward )
+ {
+ tet_infoline( "Verifying PageTurnedSignal" );
+
+ if( mView == view && mPageIndex == pageIndex && mIsTurningForwards == isTurningForward )
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ // callback to be connected to PagePanSignal
+ void PagePanSignalCallback( PageTurnView view )
+ {
+ tet_infoline( "Verifying PagePannedSignal" );
+
+ if( mView == view )
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ PageTurnView& mView;
+ unsigned int& mPageIndex;
+ bool& mIsTurningForwards;
+
+};
+
+
+//Implementation of PageFactory for providing page actors to PageTurnView
+class TestPageFactory : public PageFactory
+{
+public:
+
+ TestPageFactory(ToolkitTestApplication& application)
+ : mApplication( application )
+ {
+ mSourceActors.resize(TOTAL_PAGE_NUMBER);
+ mTotalPageNumber = TOTAL_PAGE_NUMBER;
+ }
+
+ /**
+ * Query the number of pages available from the factory.
+ * The maximum available page has an ID of GetNumberOfPages()-1.
+ */
+ virtual unsigned int GetNumberOfPages()
+ {
+ return mTotalPageNumber;
+ }
+
+ /**
+ * Create an image actor to represent a page.
+ * @param[in] pageId The ID of the page to create.
+ * @return An image actor, or an uninitialized pointer if the ID is out of range.
+ */
+ virtual Actor NewPage( unsigned int pageId )
+ {
+ if(!mSourceActors[pageId])
+ {
+ Actor actor = CreateSolidColorImageActor(mApplication, Color::BLUE,IMAGE_WIDTH,IMAGE_HEIGHT);
+ actor.SetName( static_cast<std::ostringstream*>( &(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<Actor> mSourceActors;
+ unsigned int mTotalPageNumber;
+};
+
+}// namespace
+
+
+int UtcDaliPageTurnPortraitViewNew(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliPageTurnViewNew ");
+
+ // Test default constructor
+ PageTurnView portraitView;
+ DALI_TEST_CHECK( !portraitView );
+
+ // Test object creation
+ TestPageFactory factory(application);
+ portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
+ DALI_TEST_CHECK( portraitView );
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ TestPageFactory factory(application);
+ PageTurnView PortraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ // Test copy constructor
+ PageTurnView viewCopy( portraitView );
+ DALI_TEST_CHECK( viewCopy );
+
+ // Test down cast
+ Handle handleView;
+ handleView = portraitView;
+ PageTurnView downCastView = PageTurnView::DownCast( handleView );
+ DALI_TEST_CHECK( downCastView );
+ END_TEST;
+}
+
+int UtcDaliPageTurnLandscapeViewNew(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliPageTurnViewNew ");
+
+ //Test default constructor
+ PageTurnView landscapeView;
+ DALI_TEST_CHECK( !landscapeView );
+
+ // Test object creation
+ TestPageFactory factory(application);
+ landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
+ DALI_TEST_CHECK( landscapeView );
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ TestPageFactory factory(application);
+ PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ // Test copy constructor
+ PageTurnView viewCopy( landscapeView );
+ DALI_TEST_CHECK( viewCopy );
+
+ // Test down cast
+ Handle handleView;
+ handleView = landscapeView;
+ PageTurnView downCastView = PageTurnView::DownCast( handleView );
+ DALI_TEST_CHECK( downCastView );
+
+ END_TEST;
+}
+
+int UtcDaliPageTurnViewSetAndGetSpineShadowParameter(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliPageTurnViewSetAndGetSpineShadowParameter ");
+
+ TestPageFactory factory(application);
+ PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
+ DALI_TEST_CHECK( landscapeView.GetSpineShadowParameter() != SPINE_SHADOW_PARAMETER);
+ landscapeView.SetSpineShadowParameter(SPINE_SHADOW_PARAMETER);
+ DALI_TEST_CHECK( landscapeView.GetSpineShadowParameter() == SPINE_SHADOW_PARAMETER);
+ END_TEST;
+}
+
+int UtcDaliPageTurnViewGoToPageAndGetCurrentPage(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliPageTurnViewGoToPageAndGetCurrentPage ");
+
+ TestPageFactory factory(application);
+ PageTurnView portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
+ DALI_TEST_CHECK( portraitView.GetCurrentPage() == 0 );
+
+ portraitView.GoToPage( 10 );
+ DALI_TEST_CHECK( portraitView.GetCurrentPage() == 10 );
+
+ portraitView.GoToPage( 5 );
+ DALI_TEST_CHECK( portraitView.GetCurrentPage() == 5 );
+ END_TEST;
+}
+
+int UtcDaliPageTurnViewEnterLeaveEditMode(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline( " UtcDaliPageTurnViewEnterLeaveEditMode " );
+
+ TestPageFactory factory(application);
+ factory.EnableOffscreenRendering( );
+
+ PageTurnView pageTurnView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
+ pageTurnView.SetPositionInheritanceMode( USE_PARENT_POSITION );
+ Stage::GetCurrent().Add( pageTurnView );
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ pageTurnView.GoToPage(5);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+
+ Actor actor = pageTurnView.EnterEditMode();
+ // Test that when entering edit mode, current page source actor is returned.
+ unsigned int pageId;
+ std::istringstream( actor.GetName() ) >> pageId;
+ DALI_TEST_CHECK( pageId == 5 );
+
+ bool signalVerified;
+ PageTurnView currentView;
+ unsigned int pageIndex;
+ bool isTurningForwards;
+ PageSignalCallback callbackPanStarted( signalVerified, currentView, pageIndex, isTurningForwards );
+ pageTurnView.PagePanStartedSignal().Connect( &callbackPanStarted, &PageSignalCallback::PagePanSignalCallback );
+
+ currentView = pageTurnView;
+ pageIndex = 5;
+ DALI_TEST_CHECK( !callbackPanStarted.mSignalVerified );
+
+ // Test that the control does not receive pan gesture in edit-mode
+ PerformGestureDiagonalSwipe( application, Vector2(size*0.75f), Vector2(size*0.01f), 10, true, true);
+ DALI_TEST_CHECK( !callbackPanStarted.mSignalVerified );
+
+ pageTurnView.LeaveEditMode();
+ // Test that the control receives pan gesture after leaving edit-mode
+ PerformGestureDiagonalSwipe( application, Vector2(size*0.75f), Vector2(size*0.01f), 10, true, true);
+ DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
+ END_TEST;
+}
+
+int UtcDaliPageTurnViewGetHitActor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliPageTurnViewGetHitActor ");
+
+ TestPageFactory factory(application);
+ factory.EnableOffscreenRendering( );
+
+ PageTurnView pageTurnView = PageTurnPortraitView::New( factory, PAGE_SIZE );
+ pageTurnView.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pageTurnView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ Stage::GetCurrent().Add( pageTurnView );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+
+ pageTurnView.GoToPage(3);
+
+ Vector2 localCoordinate = Vector2();
+ Vector2 screenCoordinate = PAGE_SIZE*0.5f+Vector2(7.f,8.f);
+ Actor hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate );
+ DALI_TEST_CHECK( hitActor );
+ unsigned int pageId;
+ std::istringstream( hitActor.GetName() ) >> pageId;
+ DALI_TEST_CHECK( pageId == 3 );
+ DALI_TEST_EQUALS( localCoordinate, IMAGE_SIZE*0.5f+Vector2(7.f,8.f), 0.1f, TEST_LOCATION );
+
+ screenCoordinate = PAGE_SIZE*0.5f+IMAGE_SIZE;
+ hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate );
+ DALI_TEST_CHECK( !hitActor );
+ END_TEST;
+}
+
+int UtcDaliPageTurnViewRefresh(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliPageTurnViewRefresh ");
+
+ TestPageFactory factory(application);
+ factory.EnableOffscreenRendering( );
+ PageTurnView pageTurnView = PageTurnPortraitView::New( factory, PAGE_SIZE );
+ pageTurnView.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pageTurnView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ Stage::GetCurrent().Add( pageTurnView );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+
+ factory.DeletePage( 0 );
+
+ pageTurnView.RefreshCurrentPage();
+ // simply calls the certain off screen render task to refresh
+ Vector2 localCoordinate = Vector2();
+ Vector2 screenCoordinate = PAGE_SIZE*0.5f;
+ Actor hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate );
+ unsigned int pageId;
+ std::istringstream( hitActor.GetName() ) >> pageId;
+ DALI_TEST_CHECK( pageId == 0 );
+
+ pageTurnView.RefreshAll();
+ // re-parent all the source actors and refresh
+ hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate );
+ std::istringstream( hitActor.GetName() ) >> pageId;
+ DALI_TEST_CHECK( pageId == 1 );
+ END_TEST;
+}
+
+int UtcDaliPageTurnViewSignals(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliPageTurnViewSignals ");
+
+ TestPageFactory factory(application);
+ Vector2 size = Stage::GetCurrent().GetSize();
+ PageTurnView portraitView = PageTurnPortraitView::New( factory, size );
+ portraitView.SetPositionInheritanceMode( USE_PARENT_POSITION );
+ Stage::GetCurrent().Add( portraitView );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+
+ // [0]: testing PageTurnStartedSignal; [1]: testing PageTurnFinishedSignal
+ // [2]: testing PagePanStartedSignal; [3]: testing PagePanFinishedSignal
+ bool signalVerified[4];
+ PageTurnView currentView;
+ unsigned int pageIndex;
+ bool isTurningForwards;
+
+ PageSignalCallback callbackTurnStarted( signalVerified[0], currentView, pageIndex, isTurningForwards );
+ portraitView.PageTurnStartedSignal().Connect( &callbackTurnStarted, &PageSignalCallback::PageTurnSignalCallback );
+
+ PageSignalCallback callbackTurnFinished( signalVerified[1], currentView, pageIndex, isTurningForwards );
+ portraitView.PageTurnFinishedSignal().Connect( &callbackTurnFinished, &PageSignalCallback::PageTurnSignalCallback );
+
+ PageSignalCallback callbackPanStarted( signalVerified[2], currentView, pageIndex, isTurningForwards );
+ portraitView.PagePanStartedSignal().Connect( &callbackPanStarted, &PageSignalCallback::PagePanSignalCallback );
+
+ PageSignalCallback callbackPanFinished( signalVerified[3], currentView, pageIndex, isTurningForwards );
+ portraitView.PagePanFinishedSignal().Connect( &callbackPanFinished, &PageSignalCallback::PagePanSignalCallback );
+
+ DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified );
+ DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( !callbackPanStarted.mSignalVerified );
+ DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
+
+ currentView = portraitView;
+
+ //-----Test 1: pan 10 frames from position(size * 0.75f) to position(size * 0.25f), page 0 will be turned forward----
+ pageIndex = 0;
+ isTurningForwards = true;
+ // Do a pan moving up diagonally.
+ Vector2 start = size * 0.75f;
+ Vector2 direction = -size*0.05f; //-size*0.5f/10.f;
+
+ DALI_TEST_CHECK( portraitView.GetCurrentPage() == 0);
+ PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
+ DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
+ DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
+
+ PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true);
+ DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
+
+ Wait(application, 1000);
+ DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( portraitView.GetCurrentPage() == pageIndex+1); // the page is turn over
+
+ //---Test 2: pan from position( size*0.5f ) to position( size.width, size.height*0.5f ) to position( size * 0.75f ), page 1 will bent then slid back---
+ callbackTurnStarted.Reset();
+ callbackTurnFinished.Reset();
+ callbackPanStarted.Reset();
+ callbackPanFinished.Reset();
+ portraitView.GoToPage(5);
+ pageIndex = 5;
+ isTurningForwards = true;
+
+ //pan 10 frames from position( size.width, size.height*0.5f ) to position( size * 0.75f )
+ start = Vector2( size.width, size.height*0.5f );
+ direction = Vector2(-size.width*0.025f, size.height*0.025f);
+ PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
+ DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
+ DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
+
+ signalVerified[0] = false;
+ isTurningForwards = false;
+ PerformGestureDiagonalSwipe( application, start + direction*2 , direction, 5, false, true);
+ DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
+ DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); // start the sliding back
+
+ Wait(application, 1000);
+ DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( portraitView.GetCurrentPage() == pageIndex); // the page is not turned over
+
+ // ----Test 3: pan 10 frames from position( size*0.25f ) to position( size.width*0.75f, size.height*0.25f ), the previous page will be turned backwards---
+ callbackTurnStarted.Reset();
+ callbackTurnFinished.Reset();
+ callbackPanStarted.Reset();
+ callbackPanFinished.Reset();
+ portraitView.GoToPage(10);
+ pageIndex = 9; // will turn the previous page back
+ isTurningForwards = false;
+ start = size*0.25f;
+ direction = Vector2(size.x*0.05f, 0.f);
+ PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
+ DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
+ DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified );
+ DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified );
+
+ PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true);
+ DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
+ DALI_TEST_CHECK( callbackPanFinished.mSignalVerified );
+ DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
+
+ Wait( application, 1000 );
+
+ DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
+ DALI_TEST_CHECK( portraitView.GetCurrentPage() == 9);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 200;
+
+Vector3 RollLayoutItemSizeFunction(float layoutWidth, float layoutHeight, float rowSpacing)
+{
+ float height = (layoutHeight - rowSpacing) * 0.5f;
+ return Vector3(layoutWidth, height, height);
+}
+
+} // namespace
+
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an test actor for this item
+ ImageActor actor = CreateSolidColorActor(Color::RED);
+ actor.SetSize(64.0f, 64.0f);
+ return actor;
+ }
+};
+
+void dali_roll_layout_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_roll_layout_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+
+int UtcDaliRollLayoutNew(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a roll layout
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ DALI_TEST_CHECK(rollLayout);
+ END_TEST;
+}
+
+int UtcDaliRollLayoutSetAndGetRowSpacing(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a roll layout
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ // Set the row spacing
+ rollLayout->SetRowSpacing(10.0f);
+
+ // Check whether we get the correct row spacing
+ DALI_TEST_EQUALS(rollLayout->GetRowSpacing(), 10.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliRollLayoutSetAndGetItemSizeFunction(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a roll layout
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ // Set the item size function
+ rollLayout->SetItemSizeFunction(RollLayoutItemSizeFunction);
+
+ // Check whether we get the correct item size function
+ DALI_TEST_CHECK(rollLayout->GetItemSizeFunction() == RollLayoutItemSizeFunction);
+ END_TEST;
+}
+
+int UtcDaliRollLayoutSetAndGetScrollSpeedFactor(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a roll layout
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ // Set the scroll speed factor
+ rollLayout->SetScrollSpeedFactor(0.05f);
+
+ // Check whether we get the correct scroll speed factor
+ DALI_TEST_EQUALS(rollLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a roll layout
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ // Set the maximum swipe speed
+ rollLayout->SetMaximumSwipeSpeed(50.0f);
+
+ // Check whether we get the correct maximum swipe speed
+ DALI_TEST_EQUALS(rollLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a roll layout
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ // Set the flick animaiton duration
+ rollLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( rollLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliRollLayoutConstraintLeft(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*rollLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ rollLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliRollLayoutConstraintRight(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*rollLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ rollLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliRollLayoutConstraintUp(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*rollLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ rollLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliRollLayoutConstraintDown(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*rollLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ rollLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliRollLayoutScrollDirection(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ RollLayoutPtr rollLayout = RollLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*rollLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ rollLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ ItemLayoutPtr layout = rollLayout;
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ rollLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ Degree deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 0.0f);
+
+ rollLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK((deg == 180.0f));
+
+ layout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 90.f);
+
+ rollLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 270.0f);
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+
+
+
+using namespace Dali;
+using namespace Toolkit;
+
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+static bool gSelectedSignalReceived = false;
+static bool gSelected = false;
+
+const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 );
+const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 );
+} // namespace
+
+
+void rotating_selector_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void rotating_selector_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliRotatingSelectorNew(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliRotatingSelectorNew");
+ RotatingSelector selector;
+
+ DALI_TEST_CHECK(!selector);
+
+ Actor unSelectedActor = Actor::New();
+ Actor selectedActor = Actor::New();
+
+ selector = RotatingSelector::New(unSelectedActor, selectedActor);
+
+ DALI_TEST_CHECK(selector);
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ RotatingSelector selector = RotatingSelector::New(unSelectedActor, selectedActor);
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+namespace
+{
+
+// Callback test function
+void OnSelectedSignal(RotatingSelector actor, bool selected)
+{
+ gSelectedSignalReceived = true;
+ gSelected = selected;
+}
+
+}
+
+
+int UtcDaliRotatingSelectorSetSelected(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliRotatingSelectorSetSelected");
+
+ BitmapImage img = BitmapImage::New( 1,1 );
+ ImageActor unSelectedActor = ImageActor::New( img );
+ ImageActor selectedActor = ImageActor::New( img );
+
+ RotatingSelector selector = RotatingSelector::New(unSelectedActor, selectedActor);
+
+ selector.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ selector.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ selector.SetPosition( 240, 400 );
+ selector.SetSize( 100, 100 );
+
+ // connect to its selected signal
+ selector.SelectedSignal().Connect( &OnSelectedSignal );
+
+ Stage::GetCurrent().Add( selector );
+
+ gSelectedSignalReceived = false;
+ gSelected = false;
+
+ selector.SetSelected(true);
+ application.SendNotification();
+ application.Render(1000);
+ application.SendNotification();
+ application.Render(1000);
+ application.SendNotification();
+ application.Render(1000);
+
+ DALI_TEST_CHECK( selector.IsSelected() );
+ DALI_TEST_CHECK( gSelectedSignalReceived );
+ DALI_TEST_CHECK( gSelected );
+
+ gSelectedSignalReceived = false;
+ gSelected = false;
+
+ selector.SetSelected(false);
+ application.SendNotification();
+ application.Render(1000);
+ application.SendNotification();
+ application.Render(1000);
+ application.SendNotification();
+ application.Render(1000);
+
+ DALI_TEST_CHECK( gSelectedSignalReceived );
+ DALI_TEST_CHECK( !gSelected );
+ DALI_TEST_CHECK( !selector.IsSelected() );
+ END_TEST;
+}
+
+int UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor");
+
+ BitmapImage img = BitmapImage::New( 1,1 );
+ ImageActor actor1 = ImageActor::New( img );
+ ImageActor actor2 = ImageActor::New( img );
+
+ RotatingSelector selector = RotatingSelector::New(actor1, actor2);
+ Stage::GetCurrent().Add( selector );
+
+ ImageActor unSelectedActor = ImageActor::New( img );
+ ImageActor selectedActor = ImageActor::New( img );
+
+ selector.SetSelectedActor(selectedActor);
+
+ Actor actor3 = selector.GetSelectedActor();
+ DALI_TEST_CHECK( selectedActor == actor3 );
+
+ selector.SetUnSelectedActor(unSelectedActor);
+
+ Actor actor4 = selector.GetUnSelectedActor();
+ DALI_TEST_CHECK( unSelectedActor == actor4 );
+
+ END_TEST;
+}
+
+
+int UtcDaliRotatingSelectorSetSelectable(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliRotatingSelectorSetSelectable");
+
+ BitmapImage img = BitmapImage::New( 1,1 );
+ ImageActor unSelectedActor = ImageActor::New( img );
+ ImageActor selectedActor = ImageActor::New( img );
+
+ RotatingSelector selector = RotatingSelector::New(unSelectedActor, selectedActor);
+
+ selector.SetSelectable(true);
+ DALI_TEST_CHECK( selector.IsSelectable() );
+
+ selector.SetSelectable(false);
+ DALI_TEST_CHECK( !selector.IsSelectable() );
+ END_TEST;
+}
+
+int UtcDaliRotatingSelectorSignalSelected(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliRotatingSelectorSignalSelected");
+
+ BitmapImage img = BitmapImage::New( 1,1 );
+ ImageActor unSelectedActor = ImageActor::New( img );
+ ImageActor selectedActor = ImageActor::New( img );
+
+ RotatingSelector selector = RotatingSelector::New(unSelectedActor, selectedActor);
+
+ selector.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ selector.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ selector.SetPosition( 240, 400 );
+ selector.SetSize( 100, 100 );
+
+ // connect to its selected signal
+ selector.SelectedSignal().Connect( &OnSelectedSignal );
+
+ Stage::GetCurrent().Add( selector );
+
+ DALI_TEST_CHECK( !selector.IsSelected() );
+
+ gSelectedSignalReceived = false;
+ gSelected = false;
+
+ application.SendNotification();
+ application.Render(1000);
+ application.SendNotification();
+ application.Render(1000);
+
+ //Test using touch event simulation
+ Dali::Integration::TouchEvent event;
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ application.SendNotification();
+ application.Render(1000);
+ application.SendNotification();
+ application.Render(1000);
+
+ DALI_TEST_CHECK( selector.IsSelected() );
+ DALI_TEST_CHECK( gSelectedSignalReceived );
+ DALI_TEST_CHECK( gSelected );
+
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void scroll_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void scroll_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+
+const int MILLISECONDS_PER_SECOND = 1000;
+const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation
+const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete.
+
+// For Clamp Signal testing...
+const float CLAMP_EXCESS_WIDTH = 200.0f; ///< Amount of width that can be panned outside scrollview
+const float CLAMP_EXCESS_HEIGHT = 200.0f; ///< Amount of height that can be panned outside scrollview
+const int CLAMP_STEP_0_CHECK_NOTCLAMPED = 0; ///< FSM: "First check that scrollview isn't clamped"
+const int CLAMP_STEP_1_CHECK_CLAMPED_WEST = 1; ///< FSM: "Next check that scrollview clamps against left side"
+const int CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST = 2; ///< FSM: "Then check that scrollview clamps against bottom-left side"
+const int CLAMP_STEP_3_SUCCESS = 3; ///< FSM: "Finished (Success)"
+const Vector3 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f, 0.0f); ///< Scroll start position for the Clamping tests.
+const Vector2 CLAMP_TOUCH_START( 100.0f, 100.0f ); ///< Start point to touch from for the Clamping tests.
+const Vector2 CLAMP_TOUCH_MOVEMENT( 5.0f, -5.0f ); ///< Amount to move touch for each frame for the Clamping tests.
+const int CLAMP_GESTURE_FRAMES = 100; ///< Number of Frames to synthesize a gesture for the Clamping tests.
+const Vector3 TEST_ACTOR_POSITION(100.0f, 100.0f, 0.0f); ///< A Test actor position offset (arbitrary value)
+const Vector3 TEST_CONSTRAINT_OFFSET(1.0f, 2.0f, 0.0f); ///< A Test constraint offset (arbitrary value to test effects)
+const float TEST_RATIO_TOLERANCE = 0.05; ///< +/-5% tolerance for ratio comparisons.
+
+const int MAX_FRAMES_TO_TEST_OVERSHOOT = 600; ///< 10 seconds (at 60 frames per second).
+const Vector3 OVERSHOOT_START_SCROLL_POSITION(100.0f, 100.0f, 0.0f); ///< Scroll start position for the Overshoot tests.
+const float TEST_DEFAULT_SNAP_OVERSHOOT_DURATION = 0.25f; ///< 0.25 seconds should be default snap overshoot duration
+const float TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION = 0.05f; ///< a Test duration
+const float TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION = 1.5f; ///< another Test duration
+const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * 0.5f; // Same as above, but different alpha function.
+const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames)
+
+
+// Generate a PanGestureEvent to send to Core
+Integration::PanGestureEvent GeneratePan(
+ Gesture::State state,
+ const Vector2& previousPosition,
+ const Vector2& currentPosition,
+ unsigned long timeDelta,
+ unsigned int numberOfTouches = 1)
+{
+ Integration::PanGestureEvent pan(state);
+
+ pan.previousPosition = previousPosition;
+ pan.currentPosition = currentPosition;
+ pan.timeDelta = timeDelta;
+ pan.numberOfTouches = numberOfTouches;
+
+ return pan;
+}
+
+/**
+ * Helper to generate PanGestureEvent
+ *
+ * @param[in] application Application instance
+ * @param[in] state The Gesture State
+ * @param[in] pos The current position of touch.
+ */
+static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
+{
+ static Vector2 last;
+
+ if( (state == Gesture::Started) ||
+ (state == Gesture::Possible) )
+ {
+ last.x = pos.x;
+ last.y = pos.y;
+ }
+
+ application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL));
+
+ last.x = pos.x;
+ last.y = pos.y;
+}
+
+/*
+ * Simulate time passed by.
+ *
+ * @note this will always process at least 1 frame (1/60 sec)
+ *
+ * @param application Test application instance
+ * @param duration Time to pass in milliseconds.
+ * @return The actual time passed in milliseconds
+ */
+int Wait(ToolkitTestApplication& application, int duration = 0)
+{
+ int time = 0;
+
+ for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ time += RENDER_FRAME_INTERVAL;
+ }
+
+ return time;
+}
+
+// Callback probes.
+
+static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked.
+static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked.
+static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked.
+static bool gOnScrollClampedCalled; ///< Whether the OnScrollClamped signal was invoked.
+static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked.
+static ClampState3 gLastClampPosition; ///< Clamping information from OnScrollClampedEvent.
+static SnapType gLastSnapType; ///< Snaping information from SnapEvent.
+static Vector3 gConstraintResult; ///< Result from constraint.
+
+/**
+ * Invoked when scrolling starts.
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollStart( const Vector3& position )
+{
+ gOnScrollStartCalled = true;
+}
+
+/**
+ * Invoked when scrolling updates (via dragging)
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollUpdate( const Vector3& position )
+{
+ gOnScrollUpdateCalled = true;
+}
+
+/**
+ * Invoked when scrolling finishes
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollComplete( const Vector3& position )
+{
+ gOnScrollCompleteCalled = true;
+}
+
+/**
+ * Invoked when scrolling clamped.
+ *
+ * @param[in] event The position/scale/rotation axes that were clamped.
+ */
+static void OnScrollClamped( const ScrollView::ClampEvent& event )
+{
+ gOnScrollClampedCalled = true;
+ gLastClampPosition = event.position;
+}
+
+/**
+ * Invoked when a snap or flick started.
+ *
+ * @param[in] event The type of snap and the target position/scale/rotation.
+ */
+static void OnSnapStart( const ScrollView::SnapEvent& event )
+{
+ gOnSnapStartCalled = true;
+ gLastSnapType = event.type;
+}
+
+/**
+ * TestSumConstraint
+ *
+ * Summation of current value, property, and offset.
+ *
+ * current' = current + mOffset + property;
+ */
+struct TestSumConstraint
+{
+ /**
+ * @param[in] offset The offset to be added to current.
+ */
+ TestSumConstraint(const Vector3& offset)
+ :mOffset(offset)
+ {
+ }
+
+ /**
+ * @param[in] current The current base value
+ * @param[in] property The property to be added to current.
+ * @return The new current Vector.
+ */
+ Vector3 operator()(const Vector3& current)
+ {
+ gConstraintResult = current + mOffset;
+ return gConstraintResult;
+ }
+
+ /**
+ * @param[in] current The current base value
+ * @param[in] property The property to be added to current.
+ * @return The new current Vector.
+ */
+ Vector3 operator()(const Vector3& current,
+ const PropertyInput& property)
+ {
+ gConstraintResult = current + property.GetVector3() + mOffset;
+ return gConstraintResult;
+ }
+
+ Vector3 mOffset;
+
+};
+
+/**
+ * @param[in] application The application instance
+ * @param[in] scrollView The scrollView instance
+ * @return The time taken for the overshoot to reach origin (zero)
+ */
+static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView)
+{
+ Property::Index overshootPropertyX = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME);
+ Property::Index overshootPropertyY = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME);
+
+ int timeToReachOrigin = -1;
+ for(int i = 0;i<MAX_FRAMES_TO_TEST_OVERSHOOT;i++)
+ {
+ float overshootXValue = scrollView.GetProperty<float>(overshootPropertyX);
+ float overshootYValue = scrollView.GetProperty<float>(overshootPropertyY);
+ if(overshootXValue == 0.0f && overshootYValue == 0.0f)
+ {
+ break;
+ }
+
+ timeToReachOrigin += Wait(application);
+ }
+
+ return static_cast<float>(timeToReachOrigin) * 0.001f; // return in seconds not ms.
+}
+
+/**
+ * y = 2x alpha function, which is clamped between 0.0f - 1.0f
+ *
+ * Animations should appear to finish (reach 100% point)
+ * at just half the time of a regular Linear AlphaFunction.
+ *
+ * @param[in] progress value (ranges from 0.0f - 1.0f)
+ * @return interpolation value (ranges from 0.0f - 1.0f)
+ */
+float TestAlphaFunction(float progress)
+{
+ return std::min( progress * 2.0f, 1.0f );
+}
+
+} // unnamed namespace
+
+
+int UtcDaliScrollViewNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewNew");
+
+ ScrollView scrollView;
+
+ DALI_TEST_CHECK( !scrollView );
+
+ scrollView = ScrollView::New();
+
+ DALI_TEST_CHECK( scrollView );
+
+ ScrollView scrollView2(scrollView);
+
+ DALI_TEST_CHECK( scrollView2 == scrollView );
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ ScrollView scrollView = ScrollView::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliScrollViewDownCast(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewDownCast");
+
+ ScrollView scrollView = ScrollView::New();
+ BaseHandle handle(scrollView);
+
+ ScrollView newScrollView = ScrollView::DownCast( handle );
+ DALI_TEST_CHECK( scrollView );
+ DALI_TEST_CHECK( newScrollView == scrollView );
+ END_TEST;
+}
+
+int UtcDaliScrollViewScrollToPosition(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewScrollToPosition");
+
+ // Create the ScrollView actor
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ Stage::GetCurrent().Add( scrollView );
+
+ const Vector3 target = Vector3(100.0f, 200.0f, 0.0f);
+ const Vector3 target2 = Vector3(300.0f, 100.0f, 0.0f);
+
+ scrollView.ScrollTo( target, 0.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
+ scrollView.ScrollTo( target2 );
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
+
+ Wait(application);
+ END_TEST;
+}
+
+int UtcDaliScrollViewScrollToPage(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewScrollToPage");
+
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ Stage::GetCurrent().Add( scrollView );
+ RulerPtr rulerX = new FixedRuler( 100.0f );
+ rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
+ RulerPtr rulerY = new FixedRuler( 100.0f );
+ rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
+
+ scrollView.SetRulerX( rulerX );
+ scrollView.SetRulerY( rulerY );
+
+ scrollView.ScrollTo( 1, 0.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION );
+
+ scrollView.ScrollTo( 5, 0.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(500.0f, 0.0f, 0.0f), TEST_LOCATION );
+
+ scrollView.ScrollTo( 10, 0.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(200.0f, 100.0f, 0.0f), TEST_LOCATION );
+
+ scrollView.ScrollTo( 15, 0.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(700.0f, 100.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<int>(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<int>(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<int>(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<int>(scrollView.GetCurrentPage()), 0, TEST_LOCATION );
+
+ Wait(application);
+ END_TEST;
+}
+
+int UtcDaliScrollViewScrollToActor(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewScrollToActor");
+
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ Stage::GetCurrent().Add( scrollView );
+
+ Actor actorA = Actor::New();
+ const Vector3 positionA = Vector3(100.0f, 400.0f, 0.0f);
+ actorA.SetPosition(positionA);
+ scrollView.Add(actorA);
+
+ Actor actorB = Actor::New();
+ const Vector3 positionB = Vector3(500.0f, 200.0f, 0.0f);
+ actorB.SetPosition(positionB);
+ scrollView.Add(actorB);
+
+ Wait(application);
+
+ scrollView.ScrollTo(actorA, 0.0f);
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA, TEST_LOCATION );
+
+ Wait(application);
+ scrollView.ScrollTo(actorB, 0.0f);
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB, TEST_LOCATION );
+
+ scrollView.ScrollTo(actorA);
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionA, TEST_LOCATION );
+
+ scrollView.ScrollTo(actorB);
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), positionB, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewScrollToSnapPoint(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewScrollToSnapPoint");
+
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ Stage::GetCurrent().Add( scrollView );
+ RulerPtr rulerX = new FixedRuler( 100.0f );
+ rulerX->SetDomain( RulerDomain(0.0f, 800.0f, true) );
+ RulerPtr rulerY = new FixedRuler( 100.0f );
+ rulerY->SetDomain( RulerDomain(0.0f, 400.0f, true) );
+
+ scrollView.SetRulerX( rulerX );
+ scrollView.SetRulerY( rulerY );
+
+ scrollView.ScrollTo( Vector3(120.0f, 190.0f, 0.0f), 0.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(120.0f, 190.0f, 0.0f), TEST_LOCATION );
+
+ scrollView.ScrollToSnapPoint();
+
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector3(100.0f, 200.0f, 0.0f), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewRulerScale(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewRulerScale");
+
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ Stage::GetCurrent().Add( scrollView );
+
+ RulerPtr rulerScaleX = new FixedRuler(0.25f);
+ RulerPtr rulerScaleY = new DefaultRuler();
+ rulerScaleX->SetDomain( RulerDomain(0.1f, 0.9f, true) );
+ rulerScaleY->SetDomain( RulerDomain(0.1f, 2.0f, true) );
+ scrollView.SetRulerScaleX(rulerScaleX);
+ scrollView.SetRulerScaleY(rulerScaleY);
+
+ scrollView.Add(Actor::New());
+
+ // Scroll to a position, and then snap.
+ scrollView.ScaleTo(Vector3(1.95f, 1.4f, 1.0f), 0.0f);
+ scrollView.ScrollToSnapPoint();
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), Vector3(0.9f, 1.4f, 1.0f), TEST_LOCATION );
+
+ // Scroll SLOWLY to another position, and then snap.
+ scrollView.ScaleTo(Vector3(0.45f, -1.0f, 1.0f));
+ Wait(application, RENDER_DELAY_SCROLL);
+ scrollView.ScrollToSnapPoint();
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), Vector3(0.5f, 0.1f, 1.0f), TEST_LOCATION );
+
+ // Scroll to another position, and then snap.
+ scrollView.ScaleTo(Vector3(0.71f, 0.71f, 1.0f), 0.0f);
+ scrollView.ScrollToSnapPoint();
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), Vector3(0.75f, 0.71f, 1.0f), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewTransformTo(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewTransformTo");
+
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ Stage::GetCurrent().Add( scrollView );
+
+ // Position rulers.
+ RulerPtr rulerX = new FixedRuler(50.0f);
+ RulerPtr rulerY = new FixedRuler(50.0f);
+ rulerX->SetDomain( RulerDomain(0.0f, 200.0f, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, 200.0f, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+
+ // Scale rulers.
+ RulerPtr rulerScaleX = new FixedRuler(0.1f);
+ RulerPtr rulerScaleY = new FixedRuler(0.1f);
+ rulerScaleX->SetDomain( RulerDomain(0.0f, 1.0f, true) );
+ rulerScaleY->SetDomain( RulerDomain(0.0f, 1.0f, true) );
+ scrollView.SetRulerScaleX(rulerScaleX);
+ scrollView.SetRulerScaleY(rulerScaleY);
+
+ // transform to a random position/scale
+ Vector3 targetPosition = Vector3(100.0f, 200.0f, 0.0f);
+ Vector3 targetScale = Vector3(0.44f, 0.58f, 1.0f);
+ float targetRotation = 0.0f;
+ scrollView.TransformTo(targetPosition, targetScale, targetRotation, 0.0f);
+ Wait(application);
+
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), targetScale, TEST_LOCATION );
+
+ // transform to another random position/scale (SLOWLY)
+ targetPosition = Vector3(60.0f, 40.0f, 0.0f);
+ targetScale = Vector3(0.4f, 0.6f, 1.0f);
+ targetRotation = 0.0f;
+ scrollView.TransformTo(targetPosition, targetScale, targetRotation);
+ Wait(application, RENDER_DELAY_SCROLL);
+
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollScale(), targetScale, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewRefreshInterval(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewRefreshInterval");
+
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ DALI_TEST_EQUALS( scrollView.GetRefreshInterval(), 0, TEST_LOCATION);
+ scrollView.SetRefreshInterval(10);
+ DALI_TEST_EQUALS( scrollView.GetRefreshInterval(), 10, TEST_LOCATION);
+ scrollView.SetRefreshInterval(1000);
+ DALI_TEST_EQUALS( scrollView.GetRefreshInterval(), 1000, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliScrollViewWrapMode(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewWrapMode");
+
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+
+ // Position rulers. 4x4 grid.
+ RulerPtr rulerX = new FixedRuler(50.0f);
+ RulerPtr rulerY = new FixedRuler(50.0f);
+ rulerX->SetDomain( RulerDomain(0.0f, 200.0f, false) );
+ rulerY->SetDomain( RulerDomain(0.0f, 200.0f, false) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+
+ scrollView.SetWrapMode(false);
+ scrollView.ScrollTo(Vector3(225.0f, 125.0f, 0.0f), 0.0f); // 5th (1st) page across, and 3rd (3rd) page down. (wrapped)
+ Wait(application);
+ DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 17, TEST_LOCATION );
+ scrollView.SetWrapMode(true);
+ DALI_TEST_EQUALS( static_cast<int>(scrollView.GetCurrentPage()), 13, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewActorAutoSnap(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewActorAutoSnap");
+
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
+ rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+
+ const Vector3 aPosition = Vector3(200.0f, 50.0f, 0.0f);
+ Actor a = Actor::New();
+ scrollView.Add(a);
+ a.SetPosition(aPosition);
+
+ const Vector3 bPosition = Vector3(600.0f, 600.0f, 0.0f);
+ Actor b = Actor::New();
+ scrollView.Add(b);
+ b.SetPosition(bPosition);
+
+ // Goto a random position, and execute snap (should not move)
+ Vector3 targetScroll = Vector3(500.0f, 500.0f, 0.0f);
+ scrollView.ScrollTo(targetScroll, 0.0f);
+ Wait(application);
+ scrollView.ScrollToSnapPoint();
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), targetScroll, TEST_LOCATION );
+
+ // Enable ActorAutoSnap, and now try snapping.
+ scrollView.SetActorAutoSnap(true);
+ scrollView.ScrollToSnapPoint();
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), bPosition, TEST_LOCATION );
+
+ scrollView.ScrollTo(Vector3(0.0f, 0.0f, 0.0f), 0.0f);
+ Wait(application);
+ scrollView.ScrollToSnapPoint();
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), aPosition, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewSignalsStartComplete(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSignalsStartComplete");
+
+ gOnScrollStartCalled = false;
+ gOnScrollCompleteCalled = false;
+
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
+ rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+ scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
+ scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
+ scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
+ scrollView.ScrollTo( 100.0f, 100.0f );
+ Wait(application, RENDER_DELAY_SCROLL);
+
+ DALI_TEST_CHECK(gOnScrollStartCalled);
+ DALI_TEST_CHECK(gOnScrollCompleteCalled);
+ END_TEST;
+}
+
+int UtcDaliScrollViewSignalsUpdate(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSignalsUpdate");
+
+ gOnScrollStartCalled = false;
+ gOnScrollUpdateCalled = false;
+ gOnScrollCompleteCalled = false;
+
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
+ rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+ scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
+ scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
+ scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
+
+ ImageActor image = CreateSolidColorActor( Color::RED );
+ image.SetSize(stageSize);
+ image.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ image.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ scrollView.Add(image);
+
+ Wait(application);
+
+ // Do a pan starting from 100,100 and moving down diagonally.
+ Vector2 pos(100.0f, 100.0f);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ pos.x += 5.0f;
+ pos.y += 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<20;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos.x += 5.0f;
+ pos.y += 5.0f;
+ Wait(application);
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, RENDER_DELAY_SCROLL);
+
+ DALI_TEST_CHECK(gOnScrollStartCalled);
+ DALI_TEST_CHECK(gOnScrollUpdateCalled);
+ DALI_TEST_CHECK(gOnScrollCompleteCalled);
+ END_TEST;
+}
+
+// Creates a scroll domain slightly bigger than the stage size.
+// ScrollView is scrolled to center, slightly to the left.
+// Then a pan gesture is carried out causing the scrollview
+// to pan South-West direction. Resulting in ClampEvents
+// to fire (first Western boundary, then both Western and
+// Southern boundary).
+int UtcDaliScrollViewSignalsClamped(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSignalsClamped");
+
+ gOnScrollUpdateCalled = false;
+ gOnScrollCompleteCalled = false;
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+ scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
+ scrollView.ScrollClampedSignal().Connect( &OnScrollClamped );
+
+ scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
+ Wait(application);
+
+ // Now do a pan starting from 100,100 and heading South-West
+ Vector2 pos(CLAMP_TOUCH_START);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ pos += CLAMP_TOUCH_MOVEMENT; // Move South-West a little
+ Wait(application);
+
+ int step = CLAMP_STEP_0_CHECK_NOTCLAMPED;
+ // Move 500,500 pixels South-West
+ // should be initially not clamped (0)
+ // then it should clamp against West boundary (X Min) (1)
+ // then it should clamp against South-West boundary (X Min, Y Max) (2)
+ gLastClampPosition.x = Toolkit::NotClamped;
+ gLastClampPosition.y = Toolkit::NotClamped;
+
+ for(int i = 0;i<CLAMP_GESTURE_FRAMES;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos += CLAMP_TOUCH_MOVEMENT; // Move South-West a little
+ Wait(application);
+
+ if((gLastClampPosition.x == Toolkit::NotClamped) && (gLastClampPosition.y == Toolkit::NotClamped) && (step==CLAMP_STEP_0_CHECK_NOTCLAMPED))
+ {
+ step = CLAMP_STEP_1_CHECK_CLAMPED_WEST;
+ }
+ else if((gLastClampPosition.x == Toolkit::ClampedToMin) && (gLastClampPosition.y == Toolkit::NotClamped) && (step==CLAMP_STEP_1_CHECK_CLAMPED_WEST))
+ {
+ step = CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST;
+ }
+ else if((gLastClampPosition.x == Toolkit::ClampedToMin) && (gLastClampPosition.y == Toolkit::ClampedToMax) && (step==CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST))
+ {
+ step = CLAMP_STEP_3_SUCCESS;
+ }
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application);
+
+ DALI_TEST_CHECK( gOnScrollClampedCalled );
+ DALI_TEST_EQUALS( step, CLAMP_STEP_3_SUCCESS, TEST_LOCATION );
+ END_TEST;
+}
+
+static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true)
+{
+ gOnScrollStartCalled = false;
+ gOnScrollUpdateCalled = false;
+ gOnScrollCompleteCalled = false;
+ gOnSnapStartCalled = false;
+
+ // Now do a pan starting from (start) and heading (direction)
+ Vector2 pos(start);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ Wait(application);
+
+ for(int i = 0;i<frames;i++)
+ {
+ pos += direction; // Move in this direction
+ SendPan(application, Gesture::Continuing, pos);
+ Wait(application);
+ }
+
+ if(finish)
+ {
+ pos += direction; // Move in this direction.
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, RENDER_DELAY_SCROLL);
+ }
+
+ return pos;
+}
+
+int UtcDaliScrollViewScrollSensitive(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewScrollSensitive");
+
+ // 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 insensitive swipe.
+ scrollView.SetScrollSensitive(false);
+ PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
+
+ DALI_TEST_CHECK( !gOnScrollStartCalled );
+ DALI_TEST_CHECK( !gOnScrollUpdateCalled );
+ DALI_TEST_CHECK( !gOnScrollCompleteCalled );
+ DALI_TEST_CHECK( !gOnSnapStartCalled );
+
+ // Second try sensitive swipe.
+ scrollView.SetScrollSensitive(true);
+ PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
+
+ DALI_TEST_CHECK( gOnScrollStartCalled );
+ DALI_TEST_CHECK( gOnScrollUpdateCalled );
+ DALI_TEST_CHECK( gOnScrollCompleteCalled );
+ DALI_TEST_CHECK( gOnSnapStartCalled );
+ END_TEST;
+}
+
+int UtcDaliScrollViewTouchesRequired(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewTouchesRequired");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+ scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
+ scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
+ scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
+ scrollView.SnapStartedSignal().Connect( &OnSnapStart );
+
+ scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
+ Wait(application);
+
+ // First try touches required being a minimum and maximum of 2.
+ scrollView.SetTouchesRequiredForPanning(2, 2, true);
+ PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
+
+ DALI_TEST_CHECK( !gOnScrollStartCalled );
+ DALI_TEST_CHECK( !gOnScrollUpdateCalled );
+ DALI_TEST_CHECK( !gOnScrollCompleteCalled );
+ DALI_TEST_CHECK( !gOnSnapStartCalled );
+
+ // Second try touches required being a minimum and maximum of 1.
+ scrollView.SetTouchesRequiredForPanning(1, 1, true);
+ PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
+
+ DALI_TEST_CHECK( gOnScrollStartCalled );
+ DALI_TEST_CHECK( gOnScrollUpdateCalled );
+ DALI_TEST_CHECK( gOnScrollCompleteCalled );
+ DALI_TEST_CHECK( gOnSnapStartCalled );
+ END_TEST;
+}
+
+int UtcDaliScrollViewAxisAutoLock(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewAxisAutoLock");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+ scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
+ scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
+ scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
+
+ // Normal
+ scrollView.ScrollTo(Vector3(100.0f, 100.0f, 0.0f), 0.0f); // move in a little.
+ Wait(application);
+ Vector3 startPosition = scrollView.GetCurrentScrollPosition();
+ PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
+ const Vector3 positionAfterNormal = scrollView.GetCurrentScrollPosition();
+
+ // Autolock
+ scrollView.SetAxisAutoLock(true);
+ DALI_TEST_CHECK(scrollView.GetAxisAutoLock());
+
+ scrollView.ScrollTo(Vector3(100.0f, 100.0f, 0.0f), 0.0f); // move in a little.
+ Wait(application);
+ PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(5.0f, 1.0f), 50, true); // mostly horizontal
+ const Vector3 positionAfterAutoLock = scrollView.GetCurrentScrollPosition();
+
+ // compare how much the Y position has deviated for normal and autolock.
+ const float devianceNormal = fabsf(startPosition.y - positionAfterNormal.y);
+ const float devianceAutoLock = fabsf(startPosition.y - positionAfterAutoLock.y);
+
+ // in auto-lock it should be a mostly horizontal pan (thus deviance should be much lower)
+ DALI_TEST_CHECK(devianceAutoLock < devianceNormal);
+
+ scrollView.SetAxisAutoLock(false);
+ DALI_TEST_CHECK(!scrollView.GetAxisAutoLock());
+ END_TEST;
+}
+
+int UtcDaliScrollViewAxisAutoLockGradient(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewAxisAutoLockGradient");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetAxisAutoLockGradient(0.5f);
+ DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 0.5f, TEST_LOCATION);
+ scrollView.SetAxisAutoLockGradient(1.0f);
+ DALI_TEST_EQUALS(scrollView.GetAxisAutoLockGradient(), 1.0f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliScrollViewConstraints(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewConstraints");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+
+ // Add an Actor to ScrollView,
+ // Apply TestSumConstraint to ScrollView's children (includes this Actor)
+ gConstraintResult = Vector3::ZERO;
+ Actor a = Actor::New();
+ scrollView.Add(a);
+ a.SetPosition( TEST_ACTOR_POSITION );
+ Wait(application);
+
+ Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME);
+ Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
+ Source(scrollView, scrollPositionProperty),
+ TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
+ constraint.SetRemoveAction(Constraint::Discard);
+ scrollView.ApplyConstraintToChildren(constraint);
+ Wait(application);
+
+ DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
+
+ gConstraintResult = Vector3::ZERO;
+ scrollView.RemoveConstraintsFromChildren();
+ Wait(application);
+
+ DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewBind(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewBind");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+
+ // Add an Actor to ScrollView,
+ // Apply TestSumConstraint to ScrollView's children (includes this Actor)
+
+ gConstraintResult = Vector3::ZERO;
+ Actor a = Actor::New();
+ scrollView.Add(a);
+ a.SetPosition( TEST_ACTOR_POSITION );
+ Wait(application);
+
+ Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME);
+ // apply this constraint to scrollview
+ Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
+ Source(scrollView, scrollPositionProperty),
+ TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
+
+ constraint.SetRemoveAction(Constraint::Discard);
+ scrollView.ApplyConstraintToChildren(constraint);
+
+ Wait(application);
+ // Defaulty Bound.
+ DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
+
+ // UnBind
+ gConstraintResult = Vector3::ZERO;
+ scrollView.UnbindActor( a );
+ Wait(application);
+ DALI_TEST_EQUALS( gConstraintResult, Vector3::ZERO, TEST_LOCATION );
+
+ // Bind
+ gConstraintResult = Vector3::ZERO;
+ scrollView.BindActor( a );
+ Wait(application);
+ DALI_TEST_EQUALS( gConstraintResult, TEST_ACTOR_POSITION + TEST_CONSTRAINT_OFFSET, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliRulerEnableDisable(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliRulerEnableDisable");
+
+ RulerPtr ruler = new DefaultRuler();
+
+ DALI_TEST_CHECK( ruler->IsEnabled() );
+ ruler->Disable();
+ DALI_TEST_CHECK( !ruler->IsEnabled() );
+ ruler->Enable();
+ DALI_TEST_CHECK( ruler->IsEnabled() );
+ END_TEST;
+}
+
+int UtcDaliRulerDomainEnableDisable(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliRulerDomainEnableDisable");
+
+ RulerPtr ruler = new DefaultRuler();
+ DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
+
+
+ ruler->SetDomain( RulerDomain(0.0f, 100.0f, true) );
+ DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 100.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->Clamp(-200.0f), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->Clamp(200.0f), 100.0f, TEST_LOCATION );
+
+ ruler->DisableDomain();
+ DALI_TEST_EQUALS( ruler->GetDomain().GetSize(), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->Clamp(-200.0f), -200.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->Clamp(200.0f), 200.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliRulerSnapAndClamp(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliRulerSnapAndClamp");
+
+ RulerPtr ruler = new FixedRuler( 50.0f );
+ ruler->SetDomain( RulerDomain(0.0f, 400.0f, true) );
+
+ // default testing. (snap and clamp)
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f), 50.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f), 50.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f), 400.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f), 400.0f, TEST_LOCATION);
+
+ // bias testing.
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 0.5f), 50.0f, TEST_LOCATION); // No Flick
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(40.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
+
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.0f), 0.0f, TEST_LOCATION); // Flick Left
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 0.5f), 0.0f, TEST_LOCATION); // No Flick
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(20.0f, 1.0f), 50.0f, TEST_LOCATION); // Flick Right
+
+ // length testing.
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(-10.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (over left boundary)
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(-5.0f, 0.5f, 10.0f), 0.0f, TEST_LOCATION); // 10 units long (slightly ovr left boundary)
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(300.0f, 0.5f, 10.0f), 300.0f, TEST_LOCATION); // 10 units long (not over a boundary)
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(395.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (slightly over right boundary)
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(500.0f, 0.5f, 10.0f), 390.0f, TEST_LOCATION); // 10 units long (over right boundary)
+
+ // scale testing.
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(-100.0f, 0.5f, 0.0f, 2.0f), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 2.0f), 50.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(700.0f, 0.5f, 0.0f, 2.0f), 700.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(850.0f, 0.5f, 0.0f, 2.0f), 800.0f, TEST_LOCATION);
+
+ // clamp state testing.
+ ClampState clamped;
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(50.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(30.0f, 0.5f, 0.0f, 1.0f, clamped), 50.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(10.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(-40.0f, 0.5f, 0.0f, 1.0f, clamped), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( clamped, ClampedToMin, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(390.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( clamped, NotClamped, TEST_LOCATION );
+ DALI_TEST_EQUALS( ruler->SnapAndClamp(430.0f, 0.5f, 0.0f, 1.0f, clamped), 400.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( clamped, ClampedToMax, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliRulerFixedRulerSpacing(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliRulerFixedRulerSpacing");
+
+ RulerPtr rulerZero = new FixedRuler( 0.0f );
+ rulerZero->SetDomain( RulerDomain(10.0f, 90.0f, true) );
+
+ RulerPtr rulerNormal = new FixedRuler( 25.0f );
+ rulerNormal->SetDomain( RulerDomain(10.0f, 90.0f, true) );
+
+ unsigned int volume;
+ float position;
+
+ position = rulerZero->GetPositionFromPage(1, volume, true);
+ DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( volume, 1u, TEST_LOCATION );
+
+ position = rulerNormal->GetPositionFromPage(1, volume, true);
+ DALI_TEST_EQUALS( position, 35.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
+
+ position = rulerZero->GetPositionFromPage(2, volume, true);
+ DALI_TEST_EQUALS( position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( volume, 2u, TEST_LOCATION );
+
+ position = rulerNormal->GetPositionFromPage(2, volume, true);
+ DALI_TEST_EQUALS( position, 60.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( volume, 0u, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewOvershoot(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewOvershoot");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+ scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
+ scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
+ scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
+
+ scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little.
+ Wait(application);
+
+ // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch)
+ Vector2 currentPos = Vector2(100.0f, 100.0f);
+ currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false);
+ Property::Index overshootXProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME);
+ Property::Index overshootYProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME);
+ Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME);
+ float overshootXValue = scrollView.GetProperty<float>(overshootXProperty);
+ float overshootYValue = scrollView.GetProperty<float>(overshootYProperty);
+ Vector3 positionValue = scrollView.GetProperty<Vector3>(scrollPositionProperty);
+ DALI_TEST_EQUALS(overshootXValue, -1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(overshootYValue, -1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(positionValue, Vector3::ZERO, TEST_LOCATION);
+
+ float timeToReachOrigin;
+
+ // Now release touch. Overshoot should snap back to zero.
+ SendPan(application, Gesture::Finished, currentPos);
+ timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
+
+ DALI_TEST_CHECK( (timeToReachOrigin > TEST_DEFAULT_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) &&
+ (timeToReachOrigin < TEST_DEFAULT_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) );
+
+ // 2. Repeat Scroll, but this time change overshoot snap duration to shorter time
+ scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION);
+
+ currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
+ // Now release touch. Overshoot should snap back to zero.
+ SendPan(application, Gesture::Finished, currentPos);
+ timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
+
+ DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) &&
+ (timeToReachOrigin < TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) );
+
+ // 3. Repeat Scroll, but this time change overshoot snap duration to longer time.
+ scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION);
+
+ currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
+ // Now release touch. Overshoot should snap back to zero.
+ SendPan(application, Gesture::Finished, currentPos);
+ timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
+
+ DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) &&
+ (timeToReachOrigin < TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) );
+
+ // 4. Repeat Scroll, but this time change overshoot function.
+ scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction);
+
+ currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false);
+ // Now release touch. Overshoot should snap back to zero.
+ SendPan(application, Gesture::Finished, currentPos);
+ timeToReachOrigin = TestOvershootSnapDuration(application, scrollView);
+
+ DALI_TEST_CHECK( (timeToReachOrigin > TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION - TIME_TOLERANCE) &&
+ (timeToReachOrigin < TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION + TIME_TOLERANCE) );
+ END_TEST;
+}
+
+int UtcDaliScrollViewSnapAlphaFunction(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSnapAlphaFunction");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetScrollSnapAlphaFunction( AlphaFunctions::EaseIn );
+ DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction() == AlphaFunctions::EaseIn );
+ scrollView.SetScrollSnapAlphaFunction( AlphaFunctions::EaseOut );
+ DALI_TEST_CHECK( scrollView.GetScrollSnapAlphaFunction() == AlphaFunctions::EaseOut );
+
+ scrollView.SetScrollFlickAlphaFunction( AlphaFunctions::Bounce );
+ DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction() == AlphaFunctions::Bounce );
+ scrollView.SetScrollFlickAlphaFunction( AlphaFunctions::BounceBack );
+ DALI_TEST_CHECK( scrollView.GetScrollFlickAlphaFunction() == AlphaFunctions::BounceBack );
+ END_TEST;
+}
+
+int UtcDaliScrollViewSnapDuration(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSnapDuration");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetScrollSnapDuration( 1.0f );
+ DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 1.0f, TEST_LOCATION );
+ scrollView.SetScrollSnapDuration( 0.5f );
+ DALI_TEST_EQUALS( scrollView.GetScrollSnapDuration(), 0.5f, TEST_LOCATION );
+
+ scrollView.SetScrollFlickDuration( 2.0f );
+ DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 2.0f, TEST_LOCATION );
+ scrollView.SetScrollFlickDuration( 1.5f );
+ DALI_TEST_EQUALS( scrollView.GetScrollFlickDuration(), 1.5f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliScrollViewSignalsSnapStart(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSignalsSnapStart");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetRefreshInterval(0);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+ scrollView.SnapStartedSignal().Connect( &OnSnapStart );
+
+ scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
+ Wait(application);
+
+ DALI_TEST_CHECK( !gOnSnapStartCalled );
+
+ // First try a snap.
+ PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, true);
+
+ DALI_TEST_CHECK( gOnSnapStartCalled );
+ DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap );
+
+ // Second try a swipe.
+ PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, true);
+
+ DALI_TEST_CHECK( gOnSnapStartCalled );
+ DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick );
+ END_TEST;
+}
+
+
+int UtcDaliScrollViewSetMouseWheelScrollDistanceStep(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSetMouseWheelScrollDistanceStep");
+
+ ScrollView scrollView = ScrollView::New();
+ // Disable Refresh signal (TET environment cannot use adaptor's Timer)
+ scrollView.SetMouseWheelScrollDistanceStep(Vector2(30.0f, 15.0f));
+ DALI_TEST_EQUALS( scrollView.GetMouseWheelScrollDistanceStep(), Vector2(30.0f, 15.0f), TEST_LOCATION );
+ scrollView.SetMouseWheelScrollDistanceStep(Vector2(60.0f, 30.0f));
+ DALI_TEST_EQUALS( scrollView.GetMouseWheelScrollDistanceStep(), Vector2(60.0f, 30.0f), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliScrollViewGetSet(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewGetSet");
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetMaxOvershoot(50.0f, 50.0f);
+ scrollView.SetMaxFlickSpeed(0.5f);
+ DALI_TEST_EQUALS(scrollView.GetMaxFlickSpeed(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ scrollView.SetFrictionCoefficient(0.6f);
+ DALI_TEST_EQUALS(scrollView.GetFrictionCoefficient(), 0.6f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ scrollView.SetFlickSpeedCoefficient(0.7f);
+ DALI_TEST_EQUALS(scrollView.GetFlickSpeedCoefficient(), 0.7f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+
+
+using namespace Dali;
+using namespace Toolkit;
+
+void dali_scroll_view_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_scroll_view_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+const int MILLISECONDS_PER_SECOND = 1000;
+const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation
+const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete.
+
+/*
+ * Simulate time passed by.
+ *
+ * @note this will always process at least 1 frame (1/60 sec)
+ *
+ * @param application Test application instance
+ * @param duration Time to pass in milliseconds.
+ * @return The actual time passed in milliseconds
+ */
+int Wait(ToolkitTestApplication& application, int duration = 0)
+{
+ int time = 0;
+
+ for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ time += RENDER_FRAME_INTERVAL;
+ }
+
+ return time;
+}
+
+/**
+ * Creates a Ruler that snaps to a specified grid size.
+ * If that grid size is 0.0 then this ruler does not
+ * snap.
+ *
+ * @param[in] gridSize (optional) The grid size for the ruler,
+ * (Default = 0.0 i.e. no snapping)
+ * @return The ruler is returned.
+ */
+RulerPtr CreateRuler(float gridSize = 0.0f)
+{
+ if(gridSize <= Math::MACHINE_EPSILON_0)
+ {
+ return new DefaultRuler();
+ }
+ return new FixedRuler(gridSize);
+}
+
+// Callback probes.
+
+static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked.
+static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked.
+static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked.
+static Vector3 gConstraintResult; ///< Result from constraint.
+
+static ActorContainer gPages; ///< Keeps track of all the pages for applying effects.
+
+static void ResetScrollCallbackResults()
+{
+ gOnScrollStartCalled = false;
+ gOnScrollUpdateCalled = false;
+ gOnScrollCompleteCalled = false;
+}
+
+/**
+ * Invoked when scrolling starts.
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollStart( const Vector3& position )
+{
+ gOnScrollStartCalled = true;
+}
+
+/**
+ * Invoked when scrolling updates (via dragging)
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollUpdate( const Vector3& position )
+{
+ gOnScrollUpdateCalled = true;
+}
+
+/**
+ * Invoked when scrolling finishes
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollComplete( const Vector3& position )
+{
+ gOnScrollCompleteCalled = true;
+}
+
+
+ScrollView SetupTestScrollView(int rows, int columns, Vector2 size)
+{
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetSize(size);
+ scrollView.SetAnchorPoint(AnchorPoint::CENTER);
+ scrollView.SetParentOrigin(ParentOrigin::CENTER);
+ scrollView.ApplyConstraint( Constraint::New<Dali::Vector3>( 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<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+
+ gPages.clear();
+ for(int row = 0;row<rows;row++)
+ {
+ for(int column = 0;column<columns;column++)
+ {
+ Actor page = Actor::New();
+ page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ page.SetParentOrigin( ParentOrigin::CENTER );
+ page.SetAnchorPoint( AnchorPoint::CENTER );
+ page.SetPosition( column * size.x, row * size.y );
+ container.Add(page);
+
+ gPages.push_back(page);
+ }
+ }
+
+ ResetScrollCallbackResults();
+ return scrollView;
+}
+
+void CleanupTest()
+{
+ gPages.clear();
+ ResetScrollCallbackResults();
+}
+
+Actor AddActorToPage(Actor page, float x, float y, float cols, float rows)
+{
+ Stage stage = Stage::GetCurrent();
+ Vector2 stageSize = stage.GetSize();
+
+ const float margin = 10.0f;
+ const Vector2 actorSize((stageSize.x / cols) - margin, (stageSize.y / rows) - margin);
+
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::CENTER );
+ actor.SetAnchorPoint( AnchorPoint::CENTER );
+
+ Vector3 position( margin * 0.5f + (actorSize.x + margin) * x - stageSize.width * 0.5f,
+ margin * 0.5f + (actorSize.y + margin) * y - stageSize.height * 0.5f,
+ 0.0f);
+ Vector3 positionEnd( margin * 0.5f + (actorSize.x + margin) * (x + cols) - stageSize.width * 0.5f - margin,
+ margin * 0.5f + (actorSize.y + margin) * (y + rows) - stageSize.height * 0.5f - margin,
+ 0.0f);
+ Vector3 size(positionEnd - position);
+ actor.SetPosition( position + size * 0.5f);
+ actor.SetSize( positionEnd - position );
+ page.Add(actor);
+ return actor;
+}
+
+} // unnamed namespace
+
+
+int UtcDaliScrollViewPageCubeEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewPageCubeEffectSetup");
+
+ ScrollViewPageCubeEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewPageCubeEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewPageCubeEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+
+int UtcDaliScrollViewPageCarouselEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewCarouselEffectSetup");
+
+ ScrollViewPageCarouselEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewPageCarouselEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewPageCarouselEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+int UtcDaliScrollViewCarouselEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewCarouselEffectSetup");
+
+ ScrollViewCarouselEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewCarouselEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewCarouselEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+int UtcDaliScrollViewDepthEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewDepthEffectSetup");
+
+ ScrollViewDepthEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewDepthEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewDepthEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+
+int UtcDaliScrollViewPageCubeEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewPageCubeEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewPageCubeEffect effect = ScrollViewPageCubeEffect::New();
+ scrollView.ApplyEffect(effect);
+
+ for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
+ {
+ Actor page = *pageIter;
+ page.RemoveConstraints();
+ page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ effect.ApplyToPage(page, Vector2(Math::PI_2, 0.0f));
+ }
+ Wait(application);
+
+ scrollView.ScrollTo(1);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ // test that the first page has reached centre of screen
+ Vector3 pagePos = testPage.GetCurrentPosition();
+ DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ CleanupTest();
+ END_TEST;
+}
+
+int UtcDaliScrollViewPageCarouselEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewPageCarouselEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewPageCarouselEffect effect = ScrollViewPageCarouselEffect::New();
+ scrollView.ApplyEffect(effect);
+
+ for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
+ {
+ Actor page = *pageIter;
+ page.RemoveConstraints();
+ page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ effect.ApplyToPage(page);
+ }
+ Wait(application);
+
+ scrollView.ScrollTo(1, 0.5f, DirectionBiasNone);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ // test that the first page has reached centre of screen
+ Vector3 pagePos = testPage.GetCurrentPosition();
+ DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ CleanupTest();
+ END_TEST;
+}
+
+int UtcDaliScrollViewCarouselEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewCarouselEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewCarouselEffect effect = ScrollViewCarouselEffect::New();
+ scrollView.ApplyEffect(effect);
+
+ Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
+ Wait(application);
+ Vector3 actorPrePosition = actor.GetCurrentPosition();
+
+ effect.ApplyToActor( actor, Vector2(1.2f, 1.2f) );
+
+ scrollView.ScrollTo(Vector3(size.x, 0.0f, 0.0f), 0.5f, DirectionBiasNone, DirectionBiasNone);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ // test that the first page has reached centre of screen
+ Vector3 actorPostPosition = actor.GetCurrentPosition();
+ // just check the actor has moved
+ DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
+ CleanupTest();
+ END_TEST;
+}
+
+int UtcDaliScrollViewDepthEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewDepthEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewDepthEffect effect = ScrollViewDepthEffect::New();
+ scrollView.ApplyEffect(effect);
+
+ Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
+ Wait(application);
+ Vector3 actorPrePosition = actor.GetCurrentPosition();
+
+ const Vector2 positionExtent(0.5f, 2.5f);
+ const Vector2 offsetExtent(1.0f, 1.0f);
+ const float positionScale(1.5f);
+ const float scaleExtent(0.5f);
+
+ effect.ApplyToActor( actor, positionExtent, offsetExtent, positionScale, scaleExtent );
+
+ scrollView.ScrollTo(1);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ // test that the first page has reached centre of screen
+ Vector3 actorPostPosition = actor.GetCurrentPosition();
+ // just check the actor has moved
+ DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
+ CleanupTest();
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void shadow_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void shadow_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+// Negative test case for a method
+int UtcDaliShadowViewUninitialized(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliShadowViewUninitialized");
+
+ Toolkit::ShadowView view;
+ try
+ {
+ // New() must be called to create a GaussianBlurView or it wont be valid.
+ Actor a = Actor::New();
+ view.Add( a );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!view);
+ }
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliShadowViewNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliShadowViewNew");
+
+ Toolkit::ShadowView view = Toolkit::ShadowView::New();
+ DALI_TEST_CHECK( view );
+
+ Toolkit::ShadowView view2 = Toolkit::ShadowView::New(1.0f, 1.0f);
+ DALI_TEST_CHECK( view2 );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliShadowViewDownCast(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliShadowViewDownCast");
+
+ Toolkit::ShadowView view = Toolkit::ShadowView::New();
+ BaseHandle handle(view);
+
+ Toolkit::ShadowView shadowView = Toolkit::ShadowView::DownCast( handle );
+ DALI_TEST_CHECK( view );
+ DALI_TEST_CHECK( shadowView );
+ DALI_TEST_CHECK( shadowView == view );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliShadowViewPropertyNames(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliShadowViewPropertyNames");
+
+ Toolkit::ShadowView view = Toolkit::ShadowView::New();
+ DALI_TEST_CHECK( view );
+
+ // Check the names, this names are used in the shader code,
+ // if they change in the shader code, then it has to be updated here.
+ DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("BlurStrengthProperty"), TEST_LOCATION );
+ DALI_TEST_EQUALS( view.GetShadowColorPropertyIndex(), view.GetPropertyIndex("ShadowColorProperty"), TEST_LOCATION );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliShadowViewAddRemove(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliShadowViewAddRemove");
+
+ Toolkit::ShadowView view = Toolkit::ShadowView::New();
+ DALI_TEST_CHECK( view );
+
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK( !actor.OnStage() );
+
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(actor);
+ Stage::GetCurrent().Add(view);
+
+ DALI_TEST_CHECK( actor.OnStage() );
+
+ view.Remove(actor);
+
+ DALI_TEST_CHECK( !actor.OnStage() );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliShadowViewActivateDeactivate(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliShadowViewActivateDeactivate");
+
+ Toolkit::ShadowView view = Toolkit::ShadowView::New();
+ DALI_TEST_CHECK( view );
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(Actor::New());
+ Stage::GetCurrent().Add(view);
+ view.Activate();
+
+ RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
+
+ view.Deactivate();
+
+ RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+void shear_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void shear_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliShearEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::ShearEffect effect;
+
+ try
+ {
+ // New() must be called to create a ShearEffect or it wont be valid.
+ effect.SetAngleXAxis( 45.0f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliShearEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::ShearEffect effect = Toolkit::ShearEffect::New();
+
+ // Check the names, these names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetAngleXAxisPropertyName(), "uAngleXAxis", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetAngleYAxisPropertyName(), "uAngleYAxis", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
+ END_TEST;
+}
+
+namespace
+{
+
+/**
+ * Converts value to screen position in the same way that
+ * the core does under COORDINATE_TYPE_SCREEN_POSITION
+ *
+ * @param[in] value the input position value.
+ * @return The translated position value ready for gl.
+ */
+Vector2 ToScreenPosition(Vector2 value)
+{
+ Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
+ value.x = stageSize.x * 0.5f - value.x;
+ value.y = value.y - stageSize.y * 0.5f;
+
+ return value;
+}
+
+}// namespace
+
+int UtcDaliShearEffectDefaultValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::ShearEffect effect = Toolkit::ShearEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ const float angleXAxis(0.0f);
+ const float angleYAxis(0.0f);
+ const Vector2 centerValue(0.0f, 0.0f);
+
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleXAxisPropertyName().c_str(), angleXAxis ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleYAxisPropertyName().c_str(), angleYAxis ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), ToScreenPosition(centerValue) ) );
+ END_TEST;
+}
+
+int UtcDaliShearEffectCustomValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::ShearEffect effect = Toolkit::ShearEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ const float angleXAxis(10.0f);
+ const float angleYAxis(22.5f);
+ const Vector2 centerValue(50.0f, 100.0f);
+
+ effect.SetAngleXAxis( angleXAxis );
+ effect.SetAngleYAxis( angleYAxis );
+ effect.SetCenter( centerValue );
+
+ actor.SetShaderEffect(effect);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleXAxisPropertyName().c_str(), angleXAxis ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleYAxisPropertyName().c_str(), angleYAxis ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), ToScreenPosition(centerValue) ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void dali_slider_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_slider_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+}
+
+int UtcDaliSliderNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliSliderNew");
+
+ // Create the Slider actor
+ Slider slider;
+
+ DALI_TEST_CHECK( !slider );
+
+ slider = Slider::New();
+
+ DALI_TEST_CHECK( slider );
+
+ Slider slider2(slider);
+
+ DALI_TEST_CHECK( slider2 == slider );
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ Slider slider = Slider::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliSliderDestructor(void)
+{
+ ToolkitTestApplication application;
+
+ Slider* slider = new Slider();
+ delete slider;
+
+ DALI_TEST_CHECK( true );
+ END_TEST;
+}
+
+int UtcDaliSliderDownCast(void)
+{
+ ToolkitTestApplication application;
+
+ Handle handle = Slider::New();
+
+ Slider slider = Slider::DownCast( handle );
+
+ DALI_TEST_CHECK( slider == handle );
+ END_TEST;
+}
+
+static bool gSliderValueChangedCallBackCalled;
+static bool OnSliderValueChanged( Slider slider, float value )
+{
+ gSliderValueChangedCallBackCalled = true;
+ return true;
+}
+
+static bool gSliderMarkCallBackCalled;
+static bool OnSliderMark( Slider slider, int value )
+{
+ gSliderMarkCallBackCalled = true;
+ return true;
+}
+
+int UtcDaliSliderSignals(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliSliderSignals");
+
+ // Create the Popup actor
+ Slider slider = Slider::New();
+ Stage::GetCurrent().Add( slider );
+ slider.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ slider.SetAnchorPoint(ParentOrigin::TOP_LEFT);
+ slider.SetSize( Stage::GetCurrent().GetSize().x, 20.0f );
+ slider.SetPosition( 0.0f, 0.0f );
+
+ const float MIN_BOUND = 0.0f;
+ const float MAX_BOUND = 1.0f;
+ const int NUM_MARKS = 5;
+ Property::Array marks;
+ for( int i = 0; i < NUM_MARKS; ++i )
+ {
+ marks.push_back( MIN_BOUND + ( static_cast<float>(i) / ( NUM_MARKS - 1) ) * ( MAX_BOUND - MIN_BOUND ) );
+ }
+ slider.SetProperty( slider.GetPropertyIndex( Slider::MARKS_PROPERTY_NAME ), marks );
+ slider.SetProperty( slider.GetPropertyIndex( Slider::MARK_TOLERANCE_PROPERTY_NAME ), 0.1f );
+
+ slider.ValueChangedSignal().Connect( &OnSliderValueChanged );
+ slider.MarkSignal().Connect( &OnSliderMark );
+
+ application.SendNotification();
+ application.Render();
+
+ gSliderValueChangedCallBackCalled = false;
+ gSliderMarkCallBackCalled = false;
+
+ Dali::Integration::TouchEvent event;
+
+ event = Dali::Integration::TouchEvent();
+
+ const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f );
+ event.AddPoint( pointDown );
+
+ for( int i = 0; i < 5; ++i )
+ {
+ const Dali::TouchPoint pointDown( 0, TouchPoint::Motion, 10.0f + i * 10.0f, 10.0f );
+ event.AddPoint( pointDown );
+ }
+
+ const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 50.0f, 10.0f );
+ event.AddPoint( pointUp );
+
+ application.ProcessEvent( event );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSliderValueChangedCallBackCalled);
+ DALI_TEST_CHECK(gSliderMarkCallBackCalled);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void soft_button_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void soft_button_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+// Negative test case for a method
+int UtcDaliSoftButtonEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliSoftButtonEffectUninitialized");
+
+ Toolkit::SoftButtonEffect effect;
+
+ // New() must be called to create a SoftButtonEffect or it wont be valid.
+
+ DALI_TEST_CHECK(!effect);
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliSoftButtonEffectNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewNew");
+
+ Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL);
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliSoftButtonEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliSoftButtonEffectPropertyNames");
+
+ Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL);
+ DALI_TEST_CHECK( effect );
+
+ // Check the names, this names are used in the shader code,
+ // if they change in the shader code, then it has to be updated here.
+ DALI_TEST_EQUALS( effect.GetLightingIndentationAmountPropertyName(), "uLightingIndentationAmount", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetTextureDistortionAmountPropertyName(), "uTextureDistortAmount", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetAmbientLightAmountPropertyName(), "uAmbientLight", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetDiffuseLightPropertyName(), "uDiffuseLight", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetLightingMultiplierPropertyName(), "uLightMultiplier", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetInsideShapeSizeScalePropertyName(), "uInsideCircleSizeScale", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetOutsideShapeDepthPropertyName(), "uOutsideCircleDepth", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetEffectPixelAreaPropertyName(), "uEffectRegion", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetRectangleSizeScalePropertyName(), "uRectangleSizeScale", TEST_LOCATION );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+using namespace Toolkit;
+
+void spiral_layout_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void spiral_layout_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 200;
+
+Vector3 SpiralLayoutItemSizeFunction(const Vector3& layoutSize)
+{
+ float width = layoutSize.width * 0.2f;
+ return Vector3(width, width, width);
+}
+
+float SpiralLayoutSpiralRadiusFunction(const Vector3& layoutSize)
+{
+ return layoutSize.width * 0.5f;
+}
+
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an test actor for this item
+ ImageActor actor = CreateSolidColorActor(Color::RED);
+ actor.SetSize(64.0f, 64.0f);
+
+ return actor;
+ }
+};
+
+} // namespace
+
+
+int UtcDaliSpiralLayoutNew(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ DALI_TEST_CHECK(spiralLayout);
+ END_TEST;
+}
+
+int UtcDaliSpiralSetAndGetItemSizeFunction(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ // Set the item size function
+ spiralLayout->SetItemSizeFunction(SpiralLayoutItemSizeFunction);
+
+ // Check whether we get the correct item size function
+ DALI_TEST_CHECK(spiralLayout->GetItemSizeFunction() == SpiralLayoutItemSizeFunction);
+ END_TEST;
+}
+
+int UtcDaliSpiralSetAndGetItemSpacing(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ // Set the item spacing
+ spiralLayout->SetItemSpacing(Radian(0.6f));
+
+ // Check whether we get the correct item spacing
+ DALI_TEST_EQUALS(spiralLayout->GetItemSpacing(), 0.6f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSpiralSetAndGetRevolutionDistance(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ // Set the revolution distance
+ spiralLayout->SetRevolutionDistance(150.0f);
+
+ // Check whether we get the correct revolution distance
+ DALI_TEST_EQUALS(spiralLayout->GetRevolutionDistance(), 150.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSpiralSetAndGetSpiralRadiusFunction(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ // Set the spiral radius function
+ spiralLayout->SetSpiralRadiusFunction(SpiralLayoutSpiralRadiusFunction);
+
+ // Check whether we get the correct spiral radius function
+ DALI_TEST_CHECK(spiralLayout->GetSpiralRadiusFunction() == SpiralLayoutSpiralRadiusFunction);
+ END_TEST;
+}
+
+int UtcDaliSpiralSetAndGetTopItemAlignment(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ // Set the alignment of the top item
+ spiralLayout->SetTopItemAlignment(-0.25f);
+
+ // Check whether we get the correct alignment of the top item
+ DALI_TEST_EQUALS(spiralLayout->GetTopItemAlignment(), -0.25f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSpiralSetAndGetScrollSpeedFactor(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ // Set the scroll speed factor
+ spiralLayout->SetScrollSpeedFactor(0.05f);
+
+ // Check whether we get the correct scroll speed factor
+ DALI_TEST_EQUALS(spiralLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSpiralSetAndGetMaximumSwipeSpeed(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ // Set the maximum swipe speed
+ spiralLayout->SetMaximumSwipeSpeed(50.0f);
+
+ // Check whether we get the correct maximum swipe speed
+ DALI_TEST_EQUALS(spiralLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a spiral layout
+ SpiralLayoutPtr spiralLayout = SpiralLayout::New();
+
+ // Set the flick animaiton duration
+ spiralLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( spiralLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSpiralLayoutConstraintLeft(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ SpiralLayoutPtr layout = SpiralLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliSpiralLayoutConstraintRight(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ SpiralLayoutPtr layout = SpiralLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliSpiralLayoutConstraintUp(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ SpiralLayoutPtr layout = SpiralLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+
+ layout->GetClosestOnScreenLayoutPosition(0, 0.0f, vec);
+ int nextItem = layout->GetNextFocusItemID(0, 10, Dali::Toolkit::Control::Right, false);
+ DALI_TEST_CHECK(nextItem == 1);
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliSpiralLayoutConstraintDown(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ SpiralLayoutPtr layout = SpiralLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliSpiralLayoutScrollDirection(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ SpiralLayoutPtr navigationLayout = SpiralLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ ItemLayoutPtr layout = navigationLayout;
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ navigationLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ Degree deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == -45.0f);
+
+ navigationLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK((deg == 180.0f - 45.0f));
+
+ layout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 45.0f);
+
+ navigationLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == (270.0f - 45.0f));
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliSpiralLayoutGetScrollToPosition(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ SpiralLayoutPtr layout = SpiralLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view.
+ std::vector<unsigned int> indices;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ indices.push_back(i);
+ }
+ }
+
+ try
+ {
+ if (!indices.empty())
+ {
+ const unsigned int firstTargetIndex = indices[indices.size()-1];
+ // scroll to last item
+ view.ScrollToItem(firstTargetIndex, 0.00f);
+ application.Render(16); // 60hz frames
+
+ std::size_t moveCount = 0;
+ for(std::size_t i = 0; i < indices.size(); i++)
+ {
+ float layoutPosBefore = view.GetCurrentLayoutPosition(i);
+ view.ScrollToItem(indices[i], 0.0f);
+
+ application.Render(16); // 60hz frame
+
+ float layoutPosAfter = view.GetCurrentLayoutPosition(i);
+
+ if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
+ {
+ ++moveCount;
+ }
+ }
+
+ DALI_TEST_CHECK((moveCount == indices.size()));
+ }
+ }
+ catch(...)
+ {
+ tet_result(TET_FAIL);
+ }
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+
+void spot_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void spot_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliSpotUninitializedEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SpotEffect effect;
+
+ try
+ {
+ // New() must be called to create a SpotEffect or it wont be valid.
+ effect.SetRadius( 0.5f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliSpotPropertyNamesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SpotEffect effect = Toolkit::SpotEffect::New();
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSpotDefaultValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SpotEffect effect = Toolkit::SpotEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName().c_str(),
+ Vector2(0.0f, 0.0f) ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetRadiusPropertyName().c_str(),
+ 0.0f ) );
+ END_TEST;
+}
+
+int UtcDaliSpotCustomValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SpotEffect effect = Toolkit::SpotEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ effect.SetCenter( Vector2(480.0f, 800.0f) );
+ effect.SetRadius( 5.0f );
+
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName().c_str(),
+ Vector2(480.0f, 800.0f) ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetRadiusPropertyName().c_str(),
+ 5.0f ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+
+void square_dissolve_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void square_dissolve_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliSquareDissolveEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SquareDissolveEffect effect;
+
+ try
+ {
+ // New() must be called to create a SquareDissolveEffect or it wont be valid.
+ effect.SetStep( 2.0f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliSquareDissolveEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetRowsPropertyName(), "uRows", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetColumnsPropertyName(), "uColumns", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetTexSizePropertyName(), "texSize", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSquareDissolveEffectDefaultValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetStepPropertyName().c_str(),
+ 0.1f ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetRowsPropertyName().c_str(),
+ 25.0f ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetColumnsPropertyName().c_str(),
+ 25.0f ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetTexSizePropertyName().c_str(),
+ Vector2(1.0f, 1.0f) ) );
+ END_TEST;
+}
+
+int UtcDaliSquareDissolveEffectCustomValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ effect.SetStep( 2.0f );
+ effect.SetRows( 3.0f );
+ effect.SetColumns( 4.0f );
+ effect.SetTextureSize( Vector2(12.0f, 13.0f) );
+
+ actor.SetShaderEffect(effect);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetStepPropertyName().c_str(),
+ 2.0f ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetRowsPropertyName().c_str(),
+ 3.0f ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetColumnsPropertyName().c_str(),
+ 4.0f ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetTexSizePropertyName().c_str(),
+ Vector2(12.0f, 13.0f) ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void dali_tableview_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_tableview_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+
+struct Constraint100
+{
+ Constraint100( )
+ {
+ }
+
+ /**
+ * function operator to apply the parent size
+ */
+ Dali::Vector3 operator()(const Dali::Vector3& current)
+ {
+ return Dali::Vector3( 100.0f, 100.0f, 100.0f );
+ }
+};
+
+// Convenience function to quickly set up a 10x10 table with each cell being 10x10 pixels in size by default.
+static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor& actor2, Actor& actor3)
+{
+ tableView = TableView::New(10,10); // 10 by 10 grid.
+ DALI_TEST_CHECK(tableView);
+
+ Stage::GetCurrent().Add( tableView );
+ tableView.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Constraint100() ) );
+ tableView.SetLayoutAnimationDuration(0.0f);
+
+ actor1 = Actor::New();
+ actor2 = Actor::New();
+ actor3 = Actor::New();
+
+ actor1.SetSize(10,10);
+ actor2.SetSize(10,10);
+ actor3.SetSize(10,10);
+
+ tableView.AddChild(actor1, TableView::CellPosition(0,0));
+ tableView.AddChild(actor2, TableView::CellPosition(0,1));
+ tableView.AddChild(actor3, TableView::CellPosition(1,0));
+}
+
+} // namespace
+
+
+int UtcDaliTableViewNew(void)
+{
+ ToolkitTestApplication application;
+
+ TableView tableView = TableView::New(10,10);
+ DALI_TEST_CHECK(tableView);
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ TableView tableView = TableView::New(10,10);
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+// Test adjusting the metric values for the cell.
+int UtcDaliTableViewMetricsPadding(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTableViewMetricsPadding");
+
+ TableView tableView;
+ Actor actor1;
+ Actor actor2;
+ Actor actor3;
+
+ SetupTableViewAndActors(tableView, actor1, actor2, actor3);
+
+ // 1. check that padding works. no padding:
+ tableView.SetCellPadding(Size(0.0f, 0.0f));
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( tableView.GetCellPadding(), Size(0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
+
+ // 1. check that padding works. some padding:
+ tableView.SetCellPadding(Size(5.0f, 10.0f));
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( tableView.GetCellPadding(), Size(5.0f, 10.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(5.0f, 10.0f, 0.0f), TEST_LOCATION );
+ END_TEST;
+}
+
+// Test adjusting the metric values for the cell.
+int UtcDaliTableViewMetricsFixed(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTableViewMetricsFixed");
+
+ TableView tableView;
+ Actor actor1;
+ Actor actor2;
+ Actor actor3;
+
+ SetupTableViewAndActors(tableView, actor1, actor2, actor3);
+ application.SendNotification();
+ application.Render();
+
+ // 1. check that with no fixed width/heights, actors are in default position.
+ DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
+
+ // 2. check that with a fixed width & height, actors to the right and below are offsetted.
+ tableView.SetFixedWidth(0, 20.0f);
+ tableView.SetFixedHeight(0, 50.0f);
+ DALI_TEST_EQUALS( tableView.GetFixedWidth(0), 20.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( tableView.GetFixedHeight(0), 50.0f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(20.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 50.0f, 0.0f), TEST_LOCATION );
+ END_TEST;
+}
+
+// Test adjusting the metric values for the cell.
+int UtcDaliTableViewMetricsRelative(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTableViewMetricsRelative");
+
+ TableView tableView;
+ Actor actor1;
+ Actor actor2;
+ Actor actor3;
+
+ SetupTableViewAndActors(tableView, actor1, actor2, actor3);
+ application.SendNotification();
+ application.Render();
+
+ // 1. check that with no relative width/heights, actors are in default position.
+ DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
+
+ // 2. check that with a relative width & height, actors to the right and below are offsetted.
+ tableView.SetRelativeWidth(0, 0.3f); // cell 0,0 occupies 30%x50% of the grid (i.e. 30x50 pixels)
+ tableView.SetRelativeHeight(0, 0.5f);
+ DALI_TEST_EQUALS( tableView.GetRelativeWidth(0), 0.3f, TEST_LOCATION );
+ DALI_TEST_EQUALS( tableView.GetRelativeHeight(0), 0.5f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(30.0f, 0.0f, 0.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 50.0f, 0.0f), TEST_LOCATION );
+ END_TEST;
+}
+
+
+// Test animation duration setting.
+int UtcDaliTableViewAnimation(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTableViewAnimation");
+ TableView tableView = TableView::New(10,10);
+ DALI_TEST_CHECK(tableView);
+
+ tableView.SetLayoutAnimationDuration(5.0f);
+ DALI_TEST_EQUALS(tableView.GetLayoutAnimationDuration(), 5.0f, TEST_LOCATION);
+
+ tableView.SetLayoutAnimationDuration(2.5f);
+ DALI_TEST_EQUALS(tableView.GetLayoutAnimationDuration(), 2.5f, TEST_LOCATION);
+ END_TEST;
+}
+
+// Test Adding/Removing/Finding Children.
+int UtcDaliTableViewChild(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTableViewChild");
+
+ // Create a 10x10 table-view
+ TableView tableView = TableView::New(10,10);
+ DALI_TEST_CHECK( tableView );
+
+ // Check if actor doesn't exist.
+ DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) );
+
+ // Add an actor to it at 0,0
+ Actor actor = Actor::New();
+ tableView.AddChild(actor, TableView::CellPosition());
+
+ // Check if exists.
+ DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(0,0)) );
+
+ // Remove this actor
+ tableView.RemoveChildAt(TableView::CellPosition());
+
+ // Check if actor no longer exists.
+ DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) );
+
+ // Add actor to it again, but at 2,5
+ tableView.AddChild(actor, TableView::CellPosition(2,5));
+
+ // Add another actor somewhere else 7,8
+ Actor actor2 = Actor::New();
+ tableView.AddChild(actor2, TableView::CellPosition(7,8));
+
+ Actor searchActor;
+
+ // Check that no actor exists in a few random places.
+ DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) );
+ DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(2,1)) );
+ DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(6,3)) );
+ DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(9,5)) );
+
+ // Check for actors at actual positions.
+ searchActor = tableView.GetChildAt(TableView::CellPosition(2,5));
+ DALI_TEST_CHECK( searchActor == actor);
+
+ searchActor = tableView.GetChildAt(TableView::CellPosition(7,8));
+ DALI_TEST_CHECK( searchActor == actor2);
+
+ // Create a second table, and add already added Child to new one.
+ TableView tableView2 = TableView::New(5,5);
+ tableView2.AddChild(actor, TableView::CellPosition(2,2));
+ DALI_TEST_CHECK( tableView2.GetChildAt(TableView::CellPosition(2,2)) );
+ END_TEST;
+}
+
+// Test calling Add on it's own (to invoke the OnChildAdd)
+int UtcDaliTableViewAdd(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTableViewAdd");
+
+ // Create a 4x1 table-view, and just keep adding.
+ TableView tableView = TableView::New(1,4);
+ DALI_TEST_CHECK( tableView );
+
+ for(unsigned int i = 0;i<16;i++)
+ {
+ Actor currentActor = Actor::New();
+ TableView::CellPosition position = TableView::CellPosition();
+ tableView.Add( currentActor );
+ tableView.FindChildPosition(currentActor, position);
+ tet_printf("%dx%d (%d,%d)\n", tableView.GetColumns(), tableView.GetRows(), position.columnIndex, position.rowIndex);
+
+ DALI_TEST_EQUALS((position.rowIndex * 4 + position.columnIndex), i, TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+// Test cell modification.
+int UtcDaliTableViewCells(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliTableViewCells");
+
+ // Create a 10x10 table-view
+ TableView tableView = TableView::New(10,10);
+ DALI_TEST_CHECK( tableView );
+
+ // Add a few actors to the table.
+ Actor actor1 = Actor::New();
+ Actor actor2 = Actor::New();
+ Actor actor3 = Actor::New();
+ actor1.SetName("Actor1");
+ actor2.SetName("Actor2");
+ actor3.SetName("Actor3");
+
+ // note: positions are specified in reversed cartesian coords - row,col (i.e. y,x)
+ tableView.AddChild(actor1, TableView::CellPosition(0,0));
+ tableView.AddChild(actor2, TableView::CellPosition(5,5));
+ tableView.AddChild(actor3, TableView::CellPosition(7,2));
+
+ DALI_TEST_CHECK( tableView.GetRows() == 10 && tableView.GetColumns() == 10 );
+
+ // Add a row between actor1 and actor2 | insert column on actor1 and see what happens...
+ tableView.InsertRow(3);
+ tableView.InsertColumn(0);
+ DALI_TEST_CHECK( tableView.GetRows() == 11 && tableView.GetColumns() == 11 );
+
+ TableView::CellPosition cellPosition;
+ bool result;
+
+ result = tableView.FindChildPosition(actor1, cellPosition);
+ DALI_TEST_CHECK( result && cellPosition.rowIndex == 0 && cellPosition.columnIndex == 1);
+ result = tableView.FindChildPosition(actor2, cellPosition);
+ DALI_TEST_CHECK( result && cellPosition.rowIndex == 6 && cellPosition.columnIndex == 6);
+ result = tableView.FindChildPosition(actor3, cellPosition);
+ DALI_TEST_CHECK( result && cellPosition.rowIndex == 8 && cellPosition.columnIndex == 3);
+
+ // Delete a row between actor2 and actor3 | delete column on actor2 and see what happens...
+ tableView.DeleteRow(7);
+ tableView.DeleteColumn(6);
+ DALI_TEST_CHECK( tableView.GetRows() == 10 && tableView.GetColumns() == 10 );
+
+ result = tableView.FindChildPosition(actor1, cellPosition);
+ DALI_TEST_CHECK( result && cellPosition.rowIndex == 0 && cellPosition.columnIndex == 1);
+ result = tableView.FindChildPosition(actor2, cellPosition);
+ DALI_TEST_CHECK( !result );
+ result = tableView.FindChildPosition(actor3, cellPosition);
+ DALI_TEST_CHECK( result && cellPosition.rowIndex == 7 && cellPosition.columnIndex == 3);
+
+ // Delete the other two remaining actors by a row delete and a column delete.
+ std::vector<Actor> actorsRemoved;
+ tableView.DeleteRow(0, actorsRemoved);
+ tet_printf("Row Delete >> Actors Removed: %d {", actorsRemoved.size());
+ for(size_t i = 0;i<actorsRemoved.size();i++) tet_printf("%d => %s, ", i, actorsRemoved[i].GetName().c_str());
+ tet_printf("}\n");
+ DALI_TEST_EQUALS( static_cast<int>(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<actorsRemoved.size();i++) tet_printf("%d => %s, ", i, actorsRemoved[i].GetName().c_str());
+ tet_printf("}\n");
+ DALI_TEST_EQUALS( static_cast<int>(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<int>(actorsRemoved.size()), 1, TEST_LOCATION );
+ DALI_TEST_CHECK( actorsRemoved[0] == actor1 );
+
+ // Add child outside table size, forcing a resize.
+ tableView.AddChild(actor1, TableView::CellPosition(100, 100, 1, 1));
+ DALI_TEST_CHECK( tableView.GetRows() == 101 && tableView.GetColumns() == 101 );
+
+ // Add child outside table size, forcing a resize.
+ tableView.AddChild(actor1, TableView::CellPosition(110, 110, 5, 5));
+ DALI_TEST_CHECK( tableView.GetRows() == 115 && tableView.GetColumns() == 115 );
+
+ DALI_TEST_CHECK( true );
+ END_TEST;
+}
+
+int UtcDaliTableViewChildAssert(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliTableViewChildAssert");
+
+ // Create a 10x10 table-view
+ TableView tableView = TableView::New(10,10);
+ DALI_TEST_CHECK( tableView );
+ Actor childActor;
+
+ try
+ {
+ tableView.AddChild( childActor, TableView::CellPosition(0,0,5,5) );
+ // should assert
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e )
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "child", TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+int UtcDaliTableViewMetricsAssert(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliTableViewChildAssert");
+
+ // Create a 10x10 table-view
+ TableView tableView = TableView::New(10,10);
+ DALI_TEST_CHECK( tableView );
+
+ // fixeds...
+
+ try
+ {
+ tableView.SetFixedHeight( 10, 1.0f );
+
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e)
+ {
+ tet_printf("1. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "rowIndex < mFixedHeights.size()", TEST_LOCATION);
+ }
+
+ try
+ {
+ tableView.GetFixedHeight( 10 );
+
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e)
+ {
+ tet_printf("2. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "rowIndex < mFixedHeights.size()", TEST_LOCATION);
+ }
+
+ try
+ {
+ tableView.SetFixedWidth( 10, 1.0f );
+
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e)
+ {
+ tet_printf("3. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "columnIndex < mFixedWidths.size()", TEST_LOCATION);
+ }
+
+ try
+ {
+ tableView.GetFixedWidth( 10 );
+
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e)
+ {
+ tet_printf("4. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "columnIndex < mFixedWidths.size()", TEST_LOCATION);
+ }
+
+ // relatives...
+
+ try
+ {
+ tableView.SetRelativeHeight( 10, 0.1f );
+
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e)
+ {
+ tet_printf("5. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "rowIndex < mRelativeHeights.size()", TEST_LOCATION);
+ }
+
+ try
+ {
+ tableView.GetRelativeHeight( 10 );
+
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e)
+ {
+ tet_printf("6. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "rowIndex < mRelativeHeights.size()", TEST_LOCATION);
+ }
+
+ try
+ {
+ tableView.SetRelativeWidth( 10, 0.1f );
+
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e)
+ {
+ tet_printf("7. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "columnIndex < mRelativeWidths.size()", TEST_LOCATION);
+ }
+
+ try
+ {
+ tableView.GetRelativeWidth( 10 );
+
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException &e)
+ {
+ tet_printf("8. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "columnIndex < mRelativeWidths.size()", TEST_LOCATION);
+ }
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/key-event-integ.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+
+int UtcDaliTextInputSetActiveStyle(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing Setting of Style to newly added text");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ Stage::GetCurrent().Add(textInput);
+
+ const std::string styledString = "Test String<i>ab</i>" ;
+ const std::string plainString = "Test String";
+ textInput.SetInitialText( plainString );
+
+ application.SendNotification();
+ application.Render();
+
+ textInput.SetEditable(true);
+
+ std::string retreivedMarkupString = textInput.GetMarkupText();
+
+ tet_infoline("Confirm markup text is a plain string ");
+ DALI_TEST_EQUALS( plainString,textInput.GetText(), TEST_LOCATION);
+
+ TextStyle style;
+ style.SetItalics( true );
+
+ tet_infoline("Apply style to TextInput");
+ textInput.SetActiveStyle( style );
+
+ Integration::KeyEvent eventA("a", "a", 0, 0, 0, Integration::KeyEvent::Down );
+ Integration::KeyEvent eventB("b", "b", 0, 0, 0, Integration::KeyEvent::Down );
+
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(eventA);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(eventB);
+ application.SendNotification();
+ application.Render();
+
+ retreivedMarkupString = textInput.GetMarkupText();
+
+ DALI_TEST_EQUALS( styledString, retreivedMarkupString, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputApplyStyleToSelectedText(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing application of style to selected text ");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ Stage::GetCurrent().Add(textInput);
+
+ const std::string styledString = "Test <i>String</i> to style";
+ const std::string plainString = "Test String to style";
+ textInput.SetInitialText( plainString );
+
+ application.SendNotification();
+ application.Render();
+
+ textInput.SetEditable(true);
+
+ std::string retreivedMarkupString = textInput.GetMarkupText();
+
+ tet_infoline("Confirm markup text is a plain string ");
+ DALI_TEST_EQUALS( plainString,textInput.GetText(), TEST_LOCATION);
+
+ TextStyle style;
+ style.SetItalics( true );
+
+ textInput.SelectText( 5, 11 );
+
+ tet_infoline("Apply style to selected text");
+ textInput.ApplyStyle( style );
+
+ application.Render();
+
+ retreivedMarkupString = textInput.GetMarkupText();
+
+ DALI_TEST_EQUALS( styledString, retreivedMarkupString, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputApplyStyleToAll(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing application of style to all text ");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ Stage::GetCurrent().Add(textInput);
+
+ const std::string styledString = "<i>Test String to style</i>";
+ const std::string plainString = "Test String to style";
+ textInput.SetInitialText( plainString );
+
+ application.SendNotification();
+ application.Render();
+
+ textInput.SetEditable(true);
+
+ std::string retreivedMarkupString = textInput.GetMarkupText();
+
+ tet_infoline("Confirm markup text is a plain string ");
+ DALI_TEST_EQUALS( plainString,textInput.GetText(), TEST_LOCATION);
+
+ TextStyle style;
+ style.SetItalics( true );
+
+ tet_infoline("Apply style to all text");
+ textInput.ApplyStyleToAll( style );
+
+ application.Render();
+
+ retreivedMarkupString = textInput.GetMarkupText();
+
+ DALI_TEST_EQUALS( styledString, retreivedMarkupString, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputGetStyleAtCursor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Test getting style at cursor");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ Stage::GetCurrent().Add(textInput);
+
+ const std::string styledString = "Test Stringa<i>b</i>" ;
+ const std::string plainString = "Test String";
+ textInput.SetInitialText( plainString );
+
+ application.SendNotification();
+ application.Render();
+
+ textInput.SetEditable(true);
+
+ tet_infoline("Confirm style at cursor is default(plain)");
+ TextStyle style;
+ Integration::KeyEvent eventA("a", "a", 0, 0, 0, Integration::KeyEvent::Down );
+ application.ProcessEvent(eventA);
+ application.SendNotification();
+ application.Render();
+
+ TextStyle retreivedStyleAtCursor = textInput.GetStyleAtCursor();
+
+ DALI_TEST_CHECK( style == retreivedStyleAtCursor );
+ DALI_TEST_CHECK( !retreivedStyleAtCursor.GetItalics() );
+
+ tet_infoline("Set style before adding new character");
+ style.SetItalics( true );
+ textInput.SetActiveStyle( style );
+
+ Integration::KeyEvent eventB("b", "b", 0, 0, 0, Integration::KeyEvent::Down );
+ application.ProcessEvent(eventB);
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline("Confirm style at cursor is correct style");
+ retreivedStyleAtCursor = textInput.GetStyleAtCursor();
+
+ DALI_TEST_CHECK( retreivedStyleAtCursor.GetItalics() );
+
+ tet_infoline("Confirm style at cursor is not a style that was not set");
+ DALI_TEST_CHECK( !retreivedStyleAtCursor.GetUnderline() );
+
+ tet_infoline("Confirm markup text is correct");
+ DALI_TEST_EQUALS( styledString, textInput.GetMarkupText(), TEST_LOCATION);
+
+
+
+ END_TEST;
+}
+
+int UtcDaliTextInputSetAndGetTextAlignment(void)
+{
+ ToolkitTestApplication application;
+
+ TextInput textInput = TextInput::New();
+ textInput.SetTextAlignment(static_cast<Alignment::Type>( Alignment::HorizontalCenter) );
+
+ bool result = ( textInput.GetTextAlignment() & Alignment::HorizontalCenter ) ;
+
+ DALI_TEST_CHECK( result );
+
+ result = ( textInput.GetTextAlignment() & Alignment::HorizontalRight );
+
+ DALI_TEST_CHECK( !result );
+ END_TEST;
+}
+
+int UtcDaliTextInputSetAndGetMultilinePolicy(void)
+{
+ ToolkitTestApplication application;
+
+ const TextView::MultilinePolicy MULTILINE_POLICIES[] = { TextView::SplitByNewLineChar, TextView::SplitByWord, TextView::SplitByChar };
+ const unsigned int NUM_MULTILINE_POLICIES = sizeof( MULTILINE_POLICIES ) / sizeof( unsigned int );
+
+ TextInput textInput = TextInput::New();
+ Stage::GetCurrent().Add(textInput);
+ textInput.SetInitialText( "Hello world!" );
+
+ for( unsigned int epIndex = 0; epIndex < NUM_MULTILINE_POLICIES; ++epIndex )
+ {
+ textInput.SetMultilinePolicy( MULTILINE_POLICIES[epIndex] );
+
+ DALI_TEST_EQUALS( textInput.GetMultilinePolicy(), MULTILINE_POLICIES[epIndex], TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextInputSetAndGetExceedEnabled(void)
+{
+ ToolkitTestApplication application;
+
+ const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::Split, TextView::ShrinkToFit };
+ const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int );
+
+ TextInput textInput = TextInput::New();
+ Stage::GetCurrent().Add(textInput);
+ textInput.SetInitialText( "Hello world!" );
+
+ for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex )
+ {
+ textInput.SetWidthExceedPolicy( EXCEED_POLICIES[epIndex] );
+
+ DALI_TEST_EQUALS( textInput.GetWidthExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION );
+ }
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+} // namespace
+
+void dali_toolbar_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_toolbar_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliToolBarNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolBarNew");
+
+ ToolBar toolbar;
+
+ DALI_TEST_CHECK( !toolbar );
+
+ toolbar = ToolBar::New();
+
+ DALI_TEST_CHECK( toolbar );
+
+ ToolBar toolbar2(toolbar);
+
+ DALI_TEST_CHECK( toolbar2 == toolbar );
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ ToolBar toolbar = ToolBar::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ Actor actor = toolbar;
+ toolbar == ToolBar::DownCast( actor );
+
+ DALI_TEST_CHECK( toolbar );
+ END_TEST;
+}
+
+int UtcDaliToolBarSetBackground(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolBarSetBackground");
+
+ try
+ {
+ ImageActor toolBarBackground = CreateSolidColorActor( Color::RED );
+
+ ToolBar toolbar = ToolBar::New();
+ toolbar.SetBackground( toolBarBackground );
+
+ Stage::GetCurrent().Add( toolbar );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+
+ application.SendNotification(); // VCC To be removed!!
+ application.Render(); // VCC To be removed!!
+ END_TEST;
+}
+
+int UtcDaliToolBarAddControl01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolBarAddControl01");
+
+ try
+ {
+ ImageActor control1 = CreateSolidColorActor( Color::RED );
+ control1.SetSize( 100.f, 100.f );
+ ImageActor control2 = CreateSolidColorActor( Color::RED );
+ control2.SetSize( 100.f, 100.f );
+ ImageActor control3 = CreateSolidColorActor( Color::RED );
+ control3.SetSize( 100.f, 100.f );
+ ImageActor control4 = CreateSolidColorActor( Color::RED );
+ control4.SetSize( 100.f, 100.f );
+ ImageActor control5 = CreateSolidColorActor( Color::RED );
+ control5.SetSize( 100.f, 100.f );
+
+ ToolBar toolbar = ToolBar::New();
+ toolbar.SetSize( 600.f, 100.f );
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ toolbar.Add( control1 );
+ toolbar.AddControl( control2, 0.1f, Alignment::HorizontalLeft, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) );
+ toolbar.AddControl( control3, 0.1f, Alignment::HorizontalCenter, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) );
+ toolbar.AddControl( control4, 0.1f, Alignment::HorizontalCenter, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) );
+ toolbar.AddControl( control5, 0.1f, Alignment::HorizontalRight, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) );
+
+ ImageActor control6 = CreateSolidColorActor( Color::RED );
+ control6.SetSize( 100.f, 100.f );
+ ImageActor control7 = CreateSolidColorActor( Color::RED );
+ control7.SetSize( 100.f, 100.f );
+ ImageActor control8 = CreateSolidColorActor( Color::RED );
+ control8.SetSize( 100.f, 100.f );
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ toolbar.AddControl( control6, 0.4f, Alignment::HorizontalLeft, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) );
+ toolbar.AddControl( control7, 0.2f, Alignment::HorizontalCenter, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) );
+ toolbar.AddControl( control8, 0.2f, Alignment::HorizontalRight, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliToolBarAddControl02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolBarAddControl02");
+
+ bool daliAssert = false;
+
+ try
+ {
+ ImageActor control = CreateSolidColorActor( Color::RED );
+
+ ToolBar toolbar = ToolBar::New();
+
+ toolbar.AddControl( control, 0.1f, static_cast<Alignment::Type>( 99 ), Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) );
+ }
+ catch( DaliException e )
+ {
+ daliAssert = true;
+ tet_result(TET_PASS);
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ if( !daliAssert )
+ {
+ tet_result(TET_FAIL);
+ }
+ END_TEST;
+}
+
+int UtcDaliToolBarRemoveControl01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolBarRemoveControl01");
+
+ try
+ {
+ ImageActor control = CreateSolidColorActor( Color::RED );
+
+ ToolBar toolbar = ToolBar::New();
+ toolbar.AddControl( control, 0.1f, Alignment::HorizontalLeft );
+
+ toolbar.RemoveControl( control );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliToolBarRemoveControl02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolBarRemoveControl02");
+
+ try
+ {
+ ImageActor control01 = CreateSolidColorActor( Color::RED );
+ ImageActor control02 = CreateSolidColorActor( Color::RED );
+
+ ToolBar toolbar01 = ToolBar::New();
+ ToolBar toolbar02 = ToolBar::New();
+ toolbar01.AddControl( control01, 0.1f, Alignment::HorizontalLeft );
+ toolbar02.AddControl( control02, 0.1f, Alignment::HorizontalLeft );
+
+ toolbar02.RemoveControl( control01 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "false", TEST_LOCATION);
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ try
+ {
+ ImageActor control = CreateSolidColorActor( Color::RED );
+
+ ToolBar toolbar = ToolBar::New();
+ toolbar.AddControl( control, 0.1f, Alignment::HorizontalLeft );
+
+ toolbar.RemoveControl( control );
+ toolbar.RemoveControl( control );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+
+void dali_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+static bool gAnimationStarted = false;
+
+void StartAnimation( View, Animation& animation, const Orientation& orientation )
+{
+ gAnimationStarted = true;
+}
+
+
+static bool gObjectCreatedCallBackCalled;
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+
+}
+
+
+int UtcDaliViewNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliViewNew");
+
+ View view1;
+ DALI_TEST_CHECK( !view1 );
+
+ view1 = View::New();
+ DALI_TEST_CHECK( view1 );
+
+ View view2( view1 );
+ DALI_TEST_CHECK( view2 );
+
+ View view3 = view2;
+ DALI_TEST_CHECK( view3 );
+
+ view1 = NULL;
+ view2 = NULL;
+ view3 = NULL;
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ View view = View::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliViewAddGetRemoveContentLayer01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliViewAddGetRemoveContentLayer01");
+
+ View view = View::New();
+ Layer layer1;
+ Layer layer2;
+ Layer layer3;
+ Layer layer4;
+
+ // Test: add and get layers.
+ try
+ {
+ layer1 = Layer::New();
+ layer1.SetName( "Layer1" );
+ layer2 = Layer::New();
+ layer2.SetName( "Layer2" );
+
+ unsigned int layerId1 = view.AddContentLayer( layer1 );
+ unsigned int layerId2 = view.AddContentLayer( layer2 );
+
+ layer3 = view.GetContentLayer( layerId1 );
+ layer4 = view.GetContentLayer( layerId2 );
+
+ DALI_TEST_EQUALS( layer1.GetName(), layer3.GetName(), TEST_LOCATION );
+ DALI_TEST_EQUALS( layer2.GetName(), layer4.GetName(), TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while adding and geting layers to/from view.\n" );
+ tet_result(TET_FAIL);
+ }
+
+ bool test1 = false;
+ bool test2 = false;
+ // Test: remove layers.
+ try
+ {
+ view.RemoveContentLayer( layer3 );
+ view.RemoveContentLayer( layer4 );
+ test1 = true;
+ }
+ catch( ... )
+ {
+ tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while removing layers from view.\n" );
+ tet_result(TET_FAIL);
+ }
+
+ // Test: add same layers again.
+ try
+ {
+ view.AddContentLayer( layer1 );
+ view.AddContentLayer( layer2 );
+ test2 = true;
+ }
+ catch( ... )
+ {
+ tet_printf( "UtcDaliViewAddGetRemoveContentLayer: Exception while adding layers from view after have been removed.\n" );
+ tet_result(TET_FAIL);
+ }
+
+ DALI_TEST_CHECK( test1 && test2 );
+ END_TEST;
+}
+
+int UtcDaliViewAddGetRemoveContentLayer02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliViewAddGetRemoveContentLayer02");
+
+ View view = View::New();
+
+ Layer layer1 = Layer::New();
+ layer1.SetName( "Layer1" );
+ Layer layer2 = Layer::New();
+ layer2.SetName( "Layer2" );
+
+ view.AddContentLayer( layer1 );
+ view.AddContentLayer( layer2 );
+
+ // Test: add a layer twice.
+ try
+ {
+ view.AddContentLayer( layer1 );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ // Test: add an unitialized layer.
+ try
+ {
+ Layer layer;
+ view.AddContentLayer( layer );
+ }
+ catch( DaliException& e )
+ {
+ tet_printf("Assertion %s failed at %s when an unitialized layer is added.\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS( e.mCondition, "layer", TEST_LOCATION );
+ }
+
+ // Test: get a layer which was not added before.
+ Layer layer = view.GetContentLayer( 100 );
+ DALI_TEST_CHECK( !layer );
+
+ // Test: Remove a layer which was not added before.
+ try
+ {
+ Layer layer = Layer::New();
+ view.RemoveContentLayer( layer );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliViewSetGetBackgroundLayer01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliViewSetGetBackgroundLayer01");
+
+ View view;
+ Layer layer1, layer2;
+
+ // Test with an actor.
+
+ view = View::New();
+ Stage::GetCurrent().Add( view );
+
+ ImageActor background = CreateSolidColorActor( Color::RED );
+
+ view.SetBackground( background );
+
+ layer1 = view.GetBackgroundLayer();
+
+ DALI_TEST_CHECK( layer1 );
+
+ background = CreateSolidColorActor( Color::GREEN );
+
+ view.SetBackground( background );
+
+ layer2 = view.GetBackgroundLayer();
+
+ DALI_TEST_CHECK( layer2 );
+
+ Stage::GetCurrent().Remove( view );
+ END_TEST;
+}
+
+int UtcDaliViewSetGetBackgroundLayer02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliViewSetGetBackgroundLayer02");
+
+ bool assert = false;
+
+ try
+ {
+ View view = View::New();
+
+ ImageActor background = CreateSolidColorActor( Color::RED );
+
+ view.SetBackground( background );
+ }
+ catch( DaliException& e )
+ {
+ tet_printf("Assertion %s failed at %s when trying to add background to the view and the view is not on the stage.\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS( e.mCondition, "mBackgroundLayer.OnStage()", TEST_LOCATION );
+ assert = true;
+ }
+
+ DALI_TEST_CHECK( assert );
+ END_TEST;
+}
+
+int UtcDaliViewSetOrientationFunction(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliViewSetOrientationFunction");
+
+ // Test it doesn't crash
+ try
+ {
+ View view = View::New();
+ Stage::GetCurrent().Add( view );
+
+ view.SetSize( 480, 800 );
+ view.SetOrientationFunction( Degree( 0.f ), Degree( 90.f ), Degree( 180.f ), Degree( 270.f ) );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliViewOrientationChanged(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliViewOrientationChanged");
+
+ gAnimationStarted = false;
+
+ // Test it doesn't crash
+ try
+ {
+ View view = View::New();
+ Stage::GetCurrent().Add( view );
+
+ view.SetSize( 480, 800 );
+
+ view.OrientationAnimationStartedSignal().Connect( &StartAnimation );
+
+ application.SendNotification(); // Remove these two lines causes
+ application.Render(); // ToolkitTestApplication destructor to crash
+
+ //Orientation orientation = application.GetOrientation().GetHandle();
+ //application.GetOrientation().SetDegrees( 90 );
+ //view.OrientationChanged( orientation );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ // Check the view animation started.
+ DALI_TEST_CHECK( gAnimationStarted );
+ END_TEST;
+}
+
+int UtcSetAutoRotate(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcSetAutoRotate");
+
+ gAnimationStarted = false;
+
+ View view;
+
+ // Test it doesn't crash
+ try
+ {
+ view = View::New();
+ Stage::GetCurrent().Add( view );
+
+ view.SetSize( 480, 800 );
+
+ //view.OrientationAnimationStartedSignal().Connect( &StartAnimation );
+
+ application.SendNotification();
+ application.Render();
+
+ //Orientation orientation = application.GetOrientation().GetHandle();
+ //application.GetOrientation().SetDegrees( 90 );
+ //view.OrientationChanged( orientation );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ // Check the view animation started.
+ //DALI_TEST_CHECK( gAnimationStarted );
+
+
+ gAnimationStarted = false;
+
+ try
+ {
+ view = View::New();
+ view.SetAutoRotate( false ); // Animation shouldn't start.
+ Stage::GetCurrent().Add( view );
+
+ view.SetSize( 480, 800 );
+
+ application.SendNotification();
+ application.Render();
+
+ //Orientation orientation = application.GetOrientation().GetHandle();
+ //application.GetOrientation().SetDegrees( 180 );
+ //view.OrientationChanged( orientation );
+ }
+ catch( ... )
+ {
+ tet_result(TET_FAIL);
+ }
+
+ // Check the view animation didn't start.
+ DALI_TEST_CHECK( !gAnimationStarted );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+void dali_water_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_water_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+
+int UtcDaliWaterEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect;
+
+ try
+ {
+ // New() must be called to create a RippleEffect or it wont be valid.
+ effect.SetAmplitude( 0, 0.5f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliWaterEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetAmplitudePropertyName( 0 ), "uDrops[0].amplitude", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetCenterPropertyName( 0 ), "uDrops[0].center", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetPropagationPropertyName( 0 ), "uDrops[0].radius", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliWaterEffectOutOfBounds(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ try
+ {
+ // the highest index acceptable is (GetNumberOfWaves() - 1)
+ effect.SetAmplitude( effect.GetNumberOfWaves(), 0 );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK( true );
+ }
+ END_TEST;
+}
+
+int UtcDaliWaterEffectDefaultValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ // Check that the effect has the number of waves it was requested
+ DALI_TEST_CHECK( effect.GetNumberOfWaves() == 4 );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 topLeft( Stage::GetCurrent().GetSize() * 0.5f );
+ topLeft.y = -topLeft.y;
+
+ for ( unsigned int i = 0; i < effect.GetNumberOfWaves(); ++i )
+ {
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetAmplitudePropertyName(i).c_str(),
+ 0.0f ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName(i).c_str(),
+ topLeft ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetPropagationPropertyName(i).c_str(),
+ 0.0f ) );
+ }
+ END_TEST;
+}
+
+int UtcDaliWaterEffectCustomValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ effect.SetAmplitude( 0, 0.5f );
+ effect.SetCenter( 0, Vector2 ( 10.0f, 10.0f ) );
+ effect.SetPropagation( 0, 2.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetAmplitudePropertyName(0).c_str(),
+ 0.5f ) );
+
+ Vector2 centerPoint( Stage::GetCurrent().GetSize() * 0.5f );
+ centerPoint.y = -centerPoint.y;
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName(0).c_str(),
+ Vector2( centerPoint.x - 10.0f, centerPoint.y + 10.0f ) ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetPropagationPropertyName(0).c_str(),
+ 2.0f ) );
+ END_TEST;
+}
+
+int UtcDaliWaterEffectGetAmplitudePositive(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ float amplitude(0.5f);
+ DALI_TEST_CHECK(effect.GetAmplitude(0) != amplitude);
+ effect.SetAmplitude( 0, amplitude );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(amplitude, effect.GetAmplitude(0), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliWaterEffectGetAmplitudeNegative(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ try
+ {
+ effect.GetAmplitude(9999);
+ tet_result(TET_FAIL);
+ }
+ catch(DaliException& exception)
+ {
+ if (exception.mCondition == "index < mNumberOfWaves")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ END_TEST;
+}
+
+int UtcDaliWaterEffectGetCenterPositive(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ Vector2 center(10.0f, 20.0f);
+ DALI_TEST_CHECK(effect.GetCenter(0) != center);
+ effect.SetCenter( 0, center );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(center, effect.GetCenter(0), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliWaterEffectGetCenterNegative(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ try
+ {
+ effect.GetCenter(9999);
+ tet_result(TET_FAIL);
+ }
+ catch(DaliException& exception)
+ {
+ if (exception.mCondition == "index < mNumberOfWaves")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ END_TEST;
+}
+
+int UtcDaliWaterEffectGetPropagationPositive(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ float propagation(0.5f);
+ DALI_TEST_CHECK(effect.GetPropagation(0) != propagation);
+ effect.SetPropagation( 0, propagation );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(propagation, effect.GetPropagation(0), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliWaterEffectGetPropagationNegative(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ try
+ {
+ effect.GetPropagation(9999);
+ tet_result(TET_FAIL);
+ }
+ catch(DaliException& exception)
+ {
+ if (exception.mCondition == "index < mNumberOfWaves")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ END_TEST;
+}
--- /dev/null
+SET(PKG_NAME "dali-toolkit")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-core")
+SET(RPM_NAME "core-${PKG_NAME}-tests")
+
+SET(CAPI_LIB "dali-toolkit")
+
+# List of test case sources (Only these get parsed for test cases)
+SET(TC_SOURCES
+ utc-Dali-Alignment.cpp
+ utc-Dali-BubbleEmitter.cpp
+ utc-Dali-Button.cpp
+ utc-Dali-Control.cpp
+ utc-Dali-ControlImpl.cpp
+ utc-Dali-DefaultControls.cpp
+ utc-Dali-DissolveEffect.cpp
+ utc-Dali-FocusManager.cpp
+ utc-Dali-GridLayout.cpp
+ utc-Dali-IrisEffect.cpp
+ utc-Dali-ItemLayout.cpp
+ utc-Dali-ItemView.cpp
+ utc-Dali-KeyboardFocusManager.cpp
+ utc-Dali-MarkupProcessor.cpp
+ utc-Dali-MaskEffect.cpp
+ utc-Dali-NinePatchMaskEffect.cpp
+ utc-Dali-Popup.cpp
+ utc-Dali-PushButton.cpp
+ utc-Dali-Ripple2DEffect.cpp
+ utc-Dali-RippleEffect.cpp
+ utc-Dali-ScrollViewEffect.cpp
+ utc-Dali-SuperBlurView.cpp
+ utc-Dali-SwirlEffect.cpp
+ utc-Dali-TextInput.cpp
+ utc-Dali-TextView.cpp
+)
+
+# Append list of test harness files (Won't get parsed for test cases)
+LIST(APPEND TC_SOURCES
+ dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
+ dali-toolkit-test-utils/toolkit-adaptor.cpp
+ dali-toolkit-test-utils/toolkit-application.cpp
+ dali-toolkit-test-utils/toolkit-clipboard.cpp
+ dali-toolkit-test-utils/toolkit-imf-manager.cpp
+ dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
+ dali-toolkit-test-utils/toolkit-style-monitor.cpp
+ dali-toolkit-test-utils/toolkit-timer.cpp
+ dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
+ dali-toolkit-test-utils/dummy-control.cpp
+ dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ dali-toolkit-test-utils/test-application.cpp
+ dali-toolkit-test-utils/test-platform-abstraction.cpp
+ dali-toolkit-test-utils/test-gesture-manager.cpp
+ dali-toolkit-test-utils/test-gl-abstraction.cpp
+ dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
+ dali-toolkit-test-utils/test-render-controller.cpp
+ dali-toolkit-test-utils/test-trace-call-stack.cpp
+)
+
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ dali-core
+ dali
+ dali-toolkit
+)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type")
+
+FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS})
+ SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}")
+ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS})
+
+INCLUDE_DIRECTORIES(
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+ dali-toolkit-test-utils
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${EXEC_NAME}
+)
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali/dali.h>
+#include <stdarg.h>
+
+#include "dali-test-suite-utils.h"
+
+using namespace Dali;
+
+int test_return_value = TET_UNDEF;
+
+void tet_result(int value)
+{
+ // First TET_PASS should set to zero
+ // first TET_FAIL should prevent any further TET_PASS from setting back to zero
+ // Any TET_FAIL should set to fail or leave as fail
+ if( test_return_value != 1 )
+ test_return_value = value;
+}
+
+#define END_TEST \
+ return ((test_return_value>0)?1:0)
+
+
+void tet_infoline(const char* str)
+{
+ fprintf(stderr, "%s\n", str);
+}
+
+void tet_printf(const char *format, ...)
+{
+ va_list arg;
+ va_start(arg, format);
+ vfprintf(stderr, format, arg);
+ va_end(arg);
+}
+
+/**
+ * DALI_TEST_CHECK is a wrapper for tet_result.
+ * If the condition evaluates to false, then the function & line number is printed.
+ * @param[in] The boolean expression to check
+ */
+#define DALI_TEST_CHECK(condition) \
+if ( (condition) ) \
+{ \
+ tet_result(TET_PASS); \
+} \
+else \
+{ \
+ fprintf(stderr, "%s Failed in %s at line %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \
+ tet_result(TET_FAIL); \
+}
+
+bool operator==(TimePeriod a, TimePeriod b)
+{
+ return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds) ;
+}
+
+std::ostream& operator<< (std::ostream& o, const TimePeriod value)
+{
+ return o << "( Duration:" << value.durationSeconds << " Delay:" << value.delaySeconds << ")";
+}
+
+void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location)
+{
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
+
+ for (int i=0;i<9;++i)
+ {
+ equivalent &= (m1[i] != m2[i]);
+ }
+
+ if (!equivalent)
+ {
+ fprintf(stderr, "%s, checking\n"
+ "(%f, %f, %f) (%f, %f, %f)\n"
+ "(%f, %f, %f) == (%f, %f, %f)\n"
+ "(%f, %f, %f) (%f, %f, %f)\n",
+ location,
+ m1[0], m1[1], m1[2], m2[0], m2[1], m2[2],
+ m1[3], m1[4], m1[5], m2[3], m2[4], m2[5],
+ m1[6], m1[7], m1[8], m2[6], m2[7], m2[8]);
+
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location)
+{
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
+
+ for (int i=0;i<9;++i)
+ {
+ equivalent &= (fabsf(m1[i] - m2[i])<epsilon);
+ }
+
+ if (!equivalent)
+ {
+ fprintf(stderr, "%s, checking\n"
+ "(%f, %f, %f) (%f, %f, %f)\n"
+ "(%f, %f, %f) == (%f, %f, %f)\n"
+ "(%f, %f, %f) (%f, %f, %f)\n",
+ location,
+ m1[0], m1[1], m1[2], m2[0], m2[1], m2[2],
+ m1[3], m1[4], m1[5], m2[3], m2[4], m2[5],
+ m1[6], m1[7], m1[8], m2[6], m2[7], m2[8]);
+
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* location)
+{
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool identical = true;
+
+ int i;
+ for (i=0;i<16;++i)
+ {
+ if(m1[i] != m2[i])
+ {
+ identical = false;
+ break;
+ }
+ }
+
+ if (!identical)
+ {
+ fprintf(stderr, "%s, checking\n"
+ "(%f, %f, %f, %f) (%f, %f, %f, %f)\n"
+ "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n"
+ "(%f, %f, %f, %f) (%f, %f, %f, %f)\n"
+ "(%f, %f, %f, %f) (%f, %f, %f, %f)\n", location,
+ m1[0], m1[1], m1[2], m1[3], m2[0], m2[1], m2[2], m2[3],
+ m1[4], m1[5], m1[6], m1[7], m2[4], m2[5], m2[6], m2[7],
+ m1[8], m1[9], m1[10], m1[11], m2[8], m2[9], m2[10], m2[11],
+ m1[12], m1[13], m1[14], m1[15], m2[12], m2[13], m2[14], m2[15]);
+
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location)
+{
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
+
+ for (int i=0;i<16;++i)
+ {
+ equivalent &= (fabsf(m1[i] - m2[i])<epsilon);
+ }
+
+ if (!equivalent)
+ {
+ fprintf(stderr, "%s, checking\n"
+ "(%f, %f, %f, %f) (%f, %f, %f, %f)\n"
+ "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n"
+ "(%f, %f, %f, %f) (%f, %f, %f, %f)\n"
+ "(%f, %f, %f, %f) (%f, %f, %f, %f)\n", location,
+ m1[0], m1[1], m1[2], m1[3], m2[0], m2[1], m2[2], m2[3],
+ m1[4], m1[5], m1[6], m1[7], m2[4], m2[5], m2[6], m2[7],
+ m1[8], m1[9], m1[10], m1[11], m2[8], m2[9], m2[10], m2[11],
+ m1[12], m1[13], m1[14], m1[15], m2[12], m2[13], m2[14], m2[15]);
+
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+
+/**
+ * Test whether two strings are equal.
+ * @param[in] str1 The first string
+ * @param[in] str2 The second string
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location)
+{
+ DALI_TEST_EQUALS(str1.c_str(), str2, location);
+}
+
+/**
+ * Test whether two strings are equal.
+ * @param[in] str1 The first string
+ * @param[in] str2 The second string
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location)
+{
+ DALI_TEST_EQUALS(str1, str2.c_str(), location);
+}
+
+
+/**
+ * Test whether one unsigned integer value is greater than another.
+ * Test succeeds if value1 > value2
+ * @param[in] value1 The first value
+ * @param[in] value2 The second value
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_GREATER(unsigned int value1, unsigned int value2, const char* location)
+{
+ if (!(value1 > value2))
+ {
+ fprintf(stderr, "%s, checking %d > %d\n", location, value1, value2);
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+/**
+ * Test whether one float value is greater than another.
+ * Test succeeds if value1 > value2
+ * @param[in] value1 The first value
+ * @param[in] value2 The second value
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_GREATER( float value1, float value2, const char* location)
+{
+ if (!(value1 > value2))
+ {
+ fprintf(stderr, "%s, checking %f > %f\n", location, value1, value2);
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+/**
+ * Test whether the assertion condition that failed and thus triggered the
+ * exception \b e contained a given substring at the start of its literal text.
+ * @param[in] e The exception that we expect was fired by a runtime assertion
+ * failure.
+ * @param[in] conditionSubString The text that we expect to be present in an
+ * assertion which triggered the exception.
+ * @param[in] location The TEST_LOCATION macro should be used here.
+ *
+ * @remark **Side-effects:** The result of the tet test is set to TET_PASS if
+ * the substring is at the start of the exception's condition and
+ * TET_FAIL if it isn't. Note, if the result of a test is set multiple
+ * times, a TET_FAIL will override any number of TET_PASSes.
+ */
+void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location )
+{
+ if( 0u != e.mCondition.find( conditionSubString ))
+ {
+ fprintf(stderr, "Assertion %s failed at %s\n", conditionSubString.c_str(), location);
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+/** Self-documenting wrapper for DALI_TEST_ASSERT.
+ * @copydoc DALI_TEST_ASSERT()
+ */
+void DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( DaliException& exceptionFromAssertion, std::string conditionSubString, const char* location )
+{
+ DALI_TEST_ASSERT(exceptionFromAssertion, conditionSubString, location);
+}
+
+// Functor to test whether an Applied signal is emitted
+ConstraintAppliedCheck::ConstraintAppliedCheck( bool& signalReceived )
+: mSignalReceived( signalReceived )
+{
+}
+
+void ConstraintAppliedCheck::operator()( ActiveConstraint& constraint )
+{
+ mSignalReceived = true;
+}
+
+void ConstraintAppliedCheck::Reset()
+{
+ mSignalReceived = false;
+}
+
+void ConstraintAppliedCheck::CheckSignalReceived()
+{
+ if ( !mSignalReceived )
+ {
+ fprintf(stderr, "Expected Applied signal was not received\n" );
+ tet_result( TET_FAIL );
+ }
+ else
+ {
+ tet_result( TET_PASS );
+ }
+}
+
+void ConstraintAppliedCheck::CheckSignalNotReceived()
+{
+ if ( mSignalReceived )
+ {
+ fprintf(stderr, "Unexpected Applied signal was received\n" );
+ tet_result( TET_FAIL );
+ }
+ else
+ {
+ tet_result( TET_PASS );
+ }
+}
+
+
+BitmapImage CreateBitmapImage(int width, int height, const Vector4& color)
+{
+ BitmapImage image = BitmapImage::New(width, height, Pixel::RGBA8888);
+
+ PixelBuffer* pixbuf = image.GetBuffer();
+
+ // Using a 4x4 image gives a better blend with the GL implementation
+ // than a 3x3 image
+ for(size_t i=0; i<16; i++)
+ {
+ pixbuf[i*4+0] = color.r*255;
+ pixbuf[i*4+1] = color.g*255;
+ pixbuf[i*4+2] = color.b*255;
+ pixbuf[i*4+3] = color.a*255;
+ }
+
+ return image;
+}
+
+BitmapImage CreateBitmapImage()
+{
+ return CreateBitmapImage(4, 4, Color::WHITE);
+}
--- /dev/null
+#ifndef __DALI_TEST_SUITE_UTILS_H__
+#define __DALI_TEST_SUITE_UTILS_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-core.h>
+#include <dali/public-api/dali-core-capi-internal.h>
+#include <stdarg.h>
+
+void tet_infoline(const char*str);
+void tet_printf(const char *format, ...);
+
+#include "test-application.h"
+
+using namespace Dali;
+
+#define STRINGIZE_I(text) #text
+#define STRINGIZE(text) STRINGIZE_I(text)
+
+// the following is the other compilers way of token pasting, gcc seems to just concatenate strings automatically
+//#define TOKENPASTE(x,y) x ## y
+#define TOKENPASTE(x,y) x y
+#define TOKENPASTE2(x,y) TOKENPASTE( x, y )
+#define TEST_LOCATION TOKENPASTE2( "Test failed in ", TOKENPASTE2( __FILE__, TOKENPASTE2( ", line ", STRINGIZE(__LINE__) ) ) )
+
+#define TET_UNDEF 2
+#define TET_FAIL 1
+#define TET_PASS 0
+
+extern int test_return_value;
+
+void tet_result(int value);
+
+#define END_TEST \
+ return ((test_return_value>0)?1:0)
+
+void tet_infoline(const char* str);
+void tet_printf(const char *format, ...);
+
+/**
+ * DALI_TEST_CHECK is a wrapper for tet_result.
+ * If the condition evaluates to false, then the function & line number is printed.
+ * @param[in] The boolean expression to check
+ */
+#define DALI_TEST_CHECK(condition) \
+if ( (condition) ) \
+{ \
+ tet_result(TET_PASS); \
+} \
+else \
+{ \
+ fprintf(stderr, "%s Failed in %s at line %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \
+ tet_result(TET_FAIL); \
+}
+
+template <typename Type>
+inline bool CompareType(Type value1, Type value2, float epsilon);
+
+/**
+ * A helper for fuzzy-comparing Vector2 objects
+ * @param[in] vector1 the first object
+ * @param[in] vector2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template <>
+inline bool CompareType<float>(float value1, float value2, float epsilon)
+{
+ return fabsf(value1 - value2) < epsilon;
+}
+
+/**
+ * A helper for fuzzy-comparing Vector2 objects
+ * @param[in] vector1 the first object
+ * @param[in] vector2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template <>
+inline bool CompareType<Vector2>(Vector2 vector1, Vector2 vector2, float epsilon)
+{
+ return fabsf(vector1.x - vector2.x)<epsilon && fabsf(vector1.y - vector2.y)<epsilon;
+}
+
+/**
+ * A helper for fuzzy-comparing Vector3 objects
+ * @param[in] vector1 the first object
+ * @param[in] vector2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template <>
+inline bool CompareType<Vector3>(Vector3 vector1, Vector3 vector2, float epsilon)
+{
+ return fabsf(vector1.x - vector2.x)<epsilon &&
+ fabsf(vector1.y - vector2.y)<epsilon &&
+ fabsf(vector1.z - vector2.z)<epsilon;
+}
+
+
+/**
+ * A helper for fuzzy-comparing Vector4 objects
+ * @param[in] vector1 the first object
+ * @param[in] vector2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template <>
+inline bool CompareType<Vector4>(Vector4 vector1, Vector4 vector2, float epsilon)
+{
+ return fabsf(vector1.x - vector2.x)<epsilon &&
+ fabsf(vector1.y - vector2.y)<epsilon &&
+ fabsf(vector1.z - vector2.z)<epsilon &&
+ fabsf(vector1.w - vector2.w)<epsilon;
+}
+
+template <>
+inline bool CompareType<Quaternion>(Quaternion q1, Quaternion q2, float epsilon)
+{
+ Quaternion q2N = -q2; // These quaternions represent the same rotation
+ return CompareType<Vector4>(q1.mVector, q2.mVector, epsilon) || CompareType<Vector4>(q1.mVector, q2N.mVector, epsilon);
+}
+
+template <>
+inline bool CompareType<Radian>(Radian q1, Radian q2, float epsilon)
+{
+ return CompareType<float>(float(q1), float(q2), epsilon);
+}
+
+template <>
+inline bool CompareType<Degree>(Degree q1, Degree q2, float epsilon)
+{
+ return CompareType<float>(float(q1), float(q2), epsilon);
+}
+
+bool operator==(TimePeriod a, TimePeriod b);
+std::ostream& operator<< (std::ostream& o, const TimePeriod value);
+
+/**
+ * Test whether two values are equal.
+ * @param[in] value1 The first value
+ * @param[in] value2 The second value
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+template<typename TypeA, typename TypeB>
+inline void DALI_TEST_EQUALS(TypeA value1, TypeB value2, const char* location)
+{
+ if (!(value1 == value2))
+ {
+ std::ostringstream o;
+ o << value1 << " == " << value2 << std::endl;
+ fprintf(stderr, "%s, checking %s", location, o.str().c_str());
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+template<typename Type>
+inline void DALI_TEST_EQUALS(Type value1, Type value2, float epsilon, const char* location)
+{
+ if( !CompareType<Type>(value1, value2, epsilon) )
+ {
+ std::ostringstream o;
+ o << value1 << " == " << value2 << std::endl;
+ fprintf(stderr, "%s, checking %s", location, o.str().c_str());
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+/**
+ * Test whether two TimePeriods are within a certain distance of each other.
+ * @param[in] value1 The first value
+ * @param[in] value2 The second value
+ * @param[in] epsilon The values must be within this distance of each other
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+template<>
+inline void DALI_TEST_EQUALS<TimePeriod>( TimePeriod value1, TimePeriod value2, float epsilon, const char* location)
+{
+ if ((fabs(value1.durationSeconds - value2.durationSeconds) > epsilon))
+ {
+ fprintf(stderr, "%s, checking durations %f == %f, epsilon %f\n", location, value1.durationSeconds, value2.durationSeconds, epsilon);
+ tet_result(TET_FAIL);
+ }
+ else if ((fabs(value1.delaySeconds - value2.delaySeconds) > epsilon))
+ {
+ fprintf(stderr, "%s, checking delays %f == %f, epsilon %f\n", location, value1.delaySeconds, value2.delaySeconds, epsilon);
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+/**
+ * Test whether two Matrix3 objects are equal.
+ * @param[in] matrix1 The first object
+ * @param[in] matrix2 The second object
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location);
+
+/** Test whether two Matrix3 objects are equal (fuzzy compare).
+ * @param[in] matrix1 The first object
+ * @param[in] matrix2 The second object
+ * @param[in] epsilon The epsilon to use for comparison
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location);
+
+/**
+ * Test whether two Matrix objects are equal.
+ * @param[in] matrix1 The first object
+ * @param[in] matrix2 The second object
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* location);
+
+/**
+ * Test whether two Matrix objects are equal (fuzzy-compare).
+ * @param[in] matrix1 The first object
+ * @param[in] matrix2 The second object
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location);
+
+/**
+ * Test whether two strings are equal.
+ * @param[in] str1 The first string
+ * @param[in] str2 The second string
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+template<>
+inline void DALI_TEST_EQUALS<const char*>( const char* str1, const char* str2, const char* location)
+{
+ if (strcmp(str1, str2))
+ {
+ fprintf(stderr, "%s, checking '%s' == '%s'\n", location, str1, str2);
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+/**
+ * Test whether two strings are equal.
+ * @param[in] str1 The first string
+ * @param[in] str2 The second string
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+template<>
+inline void DALI_TEST_EQUALS<const std::string&>( const std::string &str1, const std::string &str2, const char* location)
+{
+ DALI_TEST_EQUALS(str1.c_str(), str2.c_str(), location);
+}
+
+/**
+ * Test whether two strings are equal.
+ * @param[in] str1 The first string
+ * @param[in] str2 The second string
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location);
+
+/**
+ * Test whether two strings are equal.
+ * @param[in] str1 The first string
+ * @param[in] str2 The second string
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location);
+
+
+/**
+ * Test whether two UTF32 strings are equal.
+ * @param[in] str1 The first string
+ * @param[in] str2 The second string
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+template<>
+inline void DALI_TEST_EQUALS<const TextArray&>( const TextArray& str1, const TextArray& str2, const char* location)
+{
+ if (!std::equal(str1.begin(), str1.end(), str2.begin()))
+ {
+ fprintf(stderr, "%s, checking '", location);
+
+ for( unsigned int i = 0; i < str1.size(); ++i)
+ {
+ fprintf(stderr, "%c", str1[i]);
+ }
+
+ fprintf(stderr, "' == '");
+
+ for( unsigned int i = 0; i < str2.size(); ++i)
+ {
+ fprintf(stderr, "%c", str2[i]);
+ }
+
+ fprintf(stderr, "'\n");
+
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+}
+
+/**
+ * Test whether one unsigned integer value is greater than another.
+ * Test succeeds if value1 > value2
+ * @param[in] value1 The first value
+ * @param[in] value2 The second value
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_GREATER(unsigned int value1, unsigned int value2, const char* location);
+
+/**
+ * Test whether one float value is greater than another.
+ * Test succeeds if value1 > value2
+ * @param[in] value1 The first value
+ * @param[in] value2 The second value
+ * @param[in] location The TEST_LOCATION macro should be used here
+ */
+void DALI_TEST_GREATER( float value1, float value2, const char* location);
+
+/**
+ * Test whether the assertion condition that failed and thus triggered the
+ * exception \b e contained a given substring at the start of its literal text.
+ * @param[in] e The exception that we expect was fired by a runtime assertion
+ * failure.
+ * @param[in] conditionSubString The text that we expect to be present in an
+ * assertion which triggered the exception.
+ * @param[in] location The TEST_LOCATION macro should be used here.
+ *
+ * @remark **Side-effects:** The result of the tet test is set to TET_PASS if
+ * the substring is at the start of the exception's condition and
+ * TET_FAIL if it isn't. Note, if the result of a test is set multiple
+ * times, a TET_FAIL will override any number of TET_PASSes.
+ */
+void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location );
+
+/** Self-documenting wrapper for DALI_TEST_ASSERT.
+ * @copydoc DALI_TEST_ASSERT()
+ */
+void DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( DaliException& exceptionFromAssertion, std::string conditionSubString, const char* location );
+
+
+// Functor to test whether an Applied signal is emitted
+struct ConstraintAppliedCheck
+{
+ ConstraintAppliedCheck( bool& signalReceived );
+ void operator()( ActiveConstraint& constraint );
+ void Reset();
+ void CheckSignalReceived();
+ void CheckSignalNotReceived();
+ bool& mSignalReceived; // owned by individual tests
+};
+
+/**
+ * A Helper to test default functions
+ */
+template <typename T>
+struct DefaultFunctionCoverage
+{
+ DefaultFunctionCoverage()
+ {
+ T a;
+ T *b = new T(a);
+ DALI_TEST_CHECK(b);
+ a = *b;
+ delete b;
+ }
+};
+
+
+// Helper to Create bitmap image
+BitmapImage CreateBitmapImage();
+BitmapImage CreateBitmapImage(int width, int height, const Vector4& color);
+
+
+#endif // __DALI_TEST_SUITE_UTILS_H__
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
+#define __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+
+// dali-test-suite-utils.h needed first, but want to prevent certain headers
+// from being read, as we want to override as much of their behaviour as possible.
+#define __DALI_STYLE_MONITOR_H__
+#define __DALI_ACCESSIBILITY_MANAGER_H__
+#define __DALI_TIMER_H__
+#define __DALI_CLIPBOARD_H__
+#define IMFMANAGER_H
+
+#include <dali-test-suite-utils.h>
+
+#include "toolkit-test-application.h"
+#include "toolkit-application.h"
+
+#endif // __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "dummy-control.h"
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+DummyControl::DummyControl()
+: mCustomSlot1Called(false)
+{
+}
+
+DummyControl::DummyControl(const DummyControl& control)
+: Control( control ),
+ mCustomSlot1Called(false),
+ mCustomSlot1Value(Vector3::ZERO)
+{
+}
+
+DummyControl::~DummyControl()
+{
+}
+
+DummyControl DummyControl::DownCast( BaseHandle handle )
+{
+ return Control::DownCast<DummyControl, DummyControlImpl>(handle);
+}
+
+DummyControl& DummyControl::operator=(const DummyControl& control)
+{
+ Control::operator=( control );
+ return *this;
+}
+
+// Used to test signal connections
+void DummyControl::CustomSlot1( Actor actor, const Vector3& value )
+{
+ mCustomSlot1Called = true;
+ mCustomSlot1Value = value;
+}
+
+DummyControl DummyControlImpl::New()
+{
+ IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl;
+ DummyControl control( *impl );
+ impl->Initialize();
+ return control;
+}
+
+DummyControlImpl::DummyControlImpl()
+: ControlImpl(true)
+{
+}
+
+DummyControlImpl::~DummyControlImpl()
+{
+}
+
+DummyControl DummyControlImplOverride::New()
+{
+ IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
+ DummyControl control( *impl );
+ impl->Initialize();
+ return control;
+}
+
+
+DummyControlImplOverride::DummyControlImplOverride()
+: DummyControlImpl(),
+ initializeCalled(false),
+ styleChangeCalled(false),
+ pinchCalled(false),
+ panCalled(false),
+ tapCalled(false),
+ longPressCalled(false),
+ stageConnectionCalled(false),
+ stageDisconnectionCalled(false),
+ childAddCalled(false),
+ childRemoveCalled(false),
+ sizeSetCalled(false),
+ sizeAnimationCalled(false),
+ touchEventCalled(false),
+ mouseWheelEventCalled(false),
+ keyEventCalled(false),
+ keyInputFocusGained(false),
+ keyInputFocusLost(false)
+{
+}
+
+DummyControlImplOverride::~DummyControlImplOverride() { }
+
+
+void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
+void DummyControlImplOverride::OnStyleChange(StyleChange change) { styleChangeCalled = true;}
+void DummyControlImplOverride::OnPinch(PinchGesture pinch) { pinchCalled = true; }
+void DummyControlImplOverride::OnPan(PanGesture pan) { panCalled = true; }
+void DummyControlImplOverride::OnTap(TapGesture tap) { tapCalled = true; }
+void DummyControlImplOverride::OnLongPress(LongPressGesture longPress) { longPressCalled = true; }
+void DummyControlImplOverride::OnStageConnection() { stageConnectionCalled = true; }
+void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; }
+void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
+void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
+void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; }
+void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; }
+bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
+bool DummyControlImplOverride::OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; }
+bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
+void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
+void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; }
+
+DummyControl DummyControl::New( bool override )
+{
+ DummyControl control;
+
+ if (override)
+ {
+ control = DummyControlImplOverride::New();
+ }
+ else
+ {
+ control = DummyControlImpl::New();
+ }
+
+ return control;
+}
+
+DummyControl::DummyControl( DummyControlImpl& implementation )
+: Control( implementation ),
+ mCustomSlot1Called(false),
+ mCustomSlot1Value(Vector3::ZERO)
+{
+}
+
+DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
+: Control( internal ),
+ mCustomSlot1Called(false),
+ mCustomSlot1Value(Vector3::ZERO)
+{
+ VerifyCustomActorPointer<DummyControlImpl>(internal);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
+#define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+class DummyControlImpl;
+
+/**
+ * Control does not have a New method so use this dummy class for the handle.
+ */
+class DummyControl : public Control
+{
+public:
+
+ DummyControl();
+ DummyControl(const DummyControl& control);
+ virtual ~DummyControl();
+
+ static DummyControl New( bool override = false );
+
+ static DummyControl DownCast( BaseHandle handle );
+
+
+ DummyControl& operator=(const DummyControl& control);
+
+ // Used to test signal connections
+ void CustomSlot1( Actor actor, const Vector3& value );
+
+public:
+
+ bool mCustomSlot1Called;
+ Vector3 mCustomSlot1Value;
+
+public: // Not intended for application developers
+
+ DummyControl( DummyControlImpl& implementation );
+ DummyControl( Dali::Internal::CustomActor* internal );
+};
+
+/**
+ * Cannot create an instance of ControlImpl, so use this dummy class for the implementation.
+ * This class does not override any of ControlImpl's behaviour.
+ */
+class DummyControlImpl : public ControlImpl
+{
+public:
+
+ static DummyControl New();
+
+public:
+ inline void EnableGestureDetection(Gesture::Type type) { ControlImpl::EnableGestureDetection(type); }
+ inline void DisableGestureDetection(Gesture::Type type) { ControlImpl::DisableGestureDetection(type); }
+ inline PinchGestureDetector GetPinchGestureDetector() const { return ControlImpl::GetPinchGestureDetector(); }
+ inline PanGestureDetector GetPanGestureDetector() const { return ControlImpl::GetPanGestureDetector(); }
+ inline TapGestureDetector GetTapGestureDetector() const { return ControlImpl::GetTapGestureDetector(); }
+ inline LongPressGestureDetector GetLongPressGestureDetector() const { return ControlImpl::GetLongPressGestureDetector(); }
+
+protected:
+
+ DummyControlImpl();
+
+ virtual ~DummyControlImpl();
+};
+
+/**
+ * Cannot create an instance of ControlImpl, so use this dummy class for the implementation.
+ * This class DOES override ControlImpl's behaviour.
+ */
+class DummyControlImplOverride : public DummyControlImpl
+{
+public:
+
+ static DummyControl New();
+
+private:
+
+ DummyControlImplOverride();
+
+ virtual ~DummyControlImplOverride();
+
+private: // From ControlImpl
+
+ virtual void OnInitialize();
+ virtual void OnStyleChange(StyleChange change);
+ virtual void OnPinch(PinchGesture pinch);
+ virtual void OnPan(PanGesture pan);
+ virtual void OnTap(TapGesture tap);
+ virtual void OnLongPress(LongPressGesture longPress);
+
+private: // From CustomActorImpl
+
+ virtual void OnStageConnection();
+ virtual void OnStageDisconnection();
+ virtual void OnChildAdd(Actor& child);
+ virtual void OnChildRemove(Actor& child);
+ virtual void OnSizeSet(const Vector3& targetSize);
+ virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
+ virtual bool OnTouchEvent(const TouchEvent& event);
+ virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
+ virtual bool OnKeyEvent(const KeyEvent& event);
+ virtual void OnKeyInputFocusGained();
+ virtual void OnKeyInputFocusLost();
+
+public:
+
+ bool initializeCalled;
+ bool styleChangeCalled;
+ bool pinchCalled;
+ bool panCalled;
+ bool tapCalled;
+ bool longPressCalled;
+ bool stageConnectionCalled;
+ bool stageDisconnectionCalled;
+ bool childAddCalled;
+ bool childRemoveCalled;
+ bool sizeSetCalled;
+ bool sizeAnimationCalled;
+ bool touchEventCalled;
+ bool mouseWheelEventCalled;
+ bool keyEventCalled;
+ bool keyInputFocusGained;
+ bool keyInputFocusLost;
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "test-application.h"
+
+namespace Dali
+{
+
+
+TestApplication::TestApplication( size_t surfaceWidth,
+ size_t surfaceHeight,
+ float horizontalDpi,
+ float verticalDpi)
+: mCore( NULL ),
+ mSurfaceWidth( surfaceWidth ),
+ mSurfaceHeight( surfaceHeight ),
+ mFrame( 0u ),
+ mDpi( horizontalDpi, verticalDpi )
+{
+ Initialize();
+}
+
+TestApplication::TestApplication( bool initialize,
+ size_t surfaceWidth,
+ size_t surfaceHeight,
+ float horizontalDpi,
+ float verticalDpi )
+: mCore( NULL ),
+ mSurfaceWidth( surfaceWidth ),
+ mSurfaceHeight( surfaceHeight ),
+ mFrame( 0u ),
+ mDpi( horizontalDpi, verticalDpi )
+{
+ if ( initialize )
+ {
+ Initialize();
+ }
+}
+
+void TestApplication::Initialize()
+{
+ mCore = Dali::Integration::Core::New(
+ mRenderController,
+ mPlatformAbstraction,
+ mGlAbstraction,
+ mGlSyncAbstraction,
+ mGestureManager );
+
+ mCore->ContextCreated();
+ mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
+ mCore->SetDpi( mDpi.x, mDpi.y );
+
+ Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
+ Dali::Integration::Log::InstallLogFunction(logFunction);
+}
+
+TestApplication::~TestApplication()
+{
+ Dali::Integration::Log::UninstallLogFunction();
+ delete mCore;
+}
+
+void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message)
+{
+ switch(level)
+ {
+ case Dali::Integration::Log::DebugInfo:
+ fprintf(stderr, "INFO: %s", message.c_str());
+ break;
+ case Dali::Integration::Log::DebugWarning:
+ fprintf(stderr, "WARN: %s", message.c_str());
+ break;
+ case Dali::Integration::Log::DebugError:
+ fprintf(stderr, "ERROR: %s", message.c_str());
+ break;
+ default:
+ fprintf(stderr, "DEFAULT: %s", message.c_str());
+ break;
+ }
+}
+
+Dali::Integration::Core& TestApplication::GetCore()
+{
+ return *mCore;
+}
+
+TestPlatformAbstraction& TestApplication::GetPlatform()
+{
+ return mPlatformAbstraction;
+}
+
+TestRenderController& TestApplication::GetRenderController()
+{
+ return mRenderController;
+}
+
+TestGlAbstraction& TestApplication::GetGlAbstraction()
+{
+ return mGlAbstraction;
+}
+
+TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction()
+{
+ return mGlSyncAbstraction;
+}
+
+TestGestureManager& TestApplication::GetGestureManager()
+{
+ return mGestureManager;
+}
+
+void TestApplication::ProcessEvent(const Integration::Event& event)
+{
+ mCore->QueueEvent(event);
+ mCore->ProcessEvents();
+}
+
+void TestApplication::SendNotification()
+{
+ mCore->ProcessEvents();
+}
+
+void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height )
+{
+ mSurfaceWidth = width;
+ mSurfaceHeight = height;
+
+ mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
+}
+
+bool TestApplication::Render( unsigned int intervalMilliseconds )
+{
+ // Update Time values
+ mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
+ unsigned int seconds(0u), microseconds(0u);
+ mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
+
+ mCore->VSync( mFrame, seconds, microseconds );
+ mCore->Update( mStatus );
+ mCore->Render( mRenderStatus );
+
+ mFrame++;
+
+ return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
+}
+
+unsigned int TestApplication::GetUpdateStatus()
+{
+ return mStatus.KeepUpdating();
+}
+
+bool TestApplication::UpdateOnly( unsigned int intervalMilliseconds )
+{
+ // Update Time values
+ mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
+ unsigned int seconds(0u), microseconds(0u);
+ mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
+
+ mCore->VSync( mFrame, seconds, microseconds );
+ mCore->Update( mStatus );
+
+ return mStatus.KeepUpdating();
+}
+
+bool TestApplication::RenderOnly( )
+{
+ // Update Time values
+ mCore->Render( mRenderStatus );
+
+ mFrame++;
+
+ return mRenderStatus.NeedsUpdate();
+}
+
+void TestApplication::ResetContext()
+{
+ mCore->ContextToBeDestroyed();
+ mCore->ContextCreated();
+}
+
+
+} // Namespace dali
--- /dev/null
+#ifndef __DALI_TEST_APPLICATION_H__
+#define __DALI_TEST_APPLICATION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <test-platform-abstraction.h>
+#include "test-gesture-manager.h"
+#include "test-gl-sync-abstraction.h"
+#include "test-gl-abstraction.h"
+#include "test-render-controller.h"
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+
+class DALI_IMPORT_API TestApplication : public ConnectionTracker
+{
+public:
+
+ // Default values derived from H2 device.
+ static const unsigned int DEFAULT_SURFACE_WIDTH = 480;
+ static const unsigned int DEFAULT_SURFACE_HEIGHT = 800;
+
+#ifdef _CPP11
+ static constexpr float DEFAULT_HORIZONTAL_DPI = 220.0f;
+ static constexpr float DEFAULT_VERTICAL_DPI = 217.0f;
+#else
+ static const float DEFAULT_HORIZONTAL_DPI = 220.0f;
+ static const float DEFAULT_VERTICAL_DPI = 217.0f;
+#endif
+
+ static const unsigned int DEFAULT_RENDER_INTERVAL = 1;
+
+ TestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
+ size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
+ float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
+ float verticalDpi = DEFAULT_VERTICAL_DPI );
+
+ TestApplication( bool initialize,
+ size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
+ size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
+ float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
+ float verticalDpi = DEFAULT_VERTICAL_DPI );
+
+ void Initialize();
+ virtual ~TestApplication();
+ static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
+ Dali::Integration::Core& GetCore();
+ TestPlatformAbstraction& GetPlatform();
+ TestRenderController& GetRenderController();
+ TestGlAbstraction& GetGlAbstraction();
+ TestGlSyncAbstraction& GetGlSyncAbstraction();
+ TestGestureManager& GetGestureManager();
+ void ProcessEvent(const Integration::Event& event);
+ void SendNotification();
+ void SetSurfaceWidth( unsigned int width, unsigned height );
+ bool Render( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
+ unsigned int GetUpdateStatus();
+ bool UpdateOnly( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
+ bool RenderOnly( );
+ void ResetContext();
+
+protected:
+ TestPlatformAbstraction mPlatformAbstraction;
+ TestRenderController mRenderController;
+ TestGlAbstraction mGlAbstraction;
+ TestGlSyncAbstraction mGlSyncAbstraction;
+ TestGestureManager mGestureManager;
+
+ Integration::UpdateStatus mStatus;
+ Integration::RenderStatus mRenderStatus;
+
+ Integration::Core* mCore;
+
+ unsigned int mSurfaceWidth;
+ unsigned int mSurfaceHeight;
+ unsigned int mFrame;
+
+ Vector2 mDpi;
+};
+
+} // Dali
+
+#endif
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "test-gesture-manager.h"
+
+namespace Dali
+{
+
+TestGestureManager::TestGestureManager()
+{
+ Initialize();
+}
+
+/**
+ * Destructor
+ */
+TestGestureManager::~TestGestureManager()
+{
+}
+
+/**
+ * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type)
+ */
+void TestGestureManager::Register(const Integration::GestureRequest& request)
+{
+ mFunctionsCalled.Register = true;
+}
+
+/**
+ * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type)
+ */
+void TestGestureManager::Unregister(const Integration::GestureRequest& request)
+{
+ mFunctionsCalled.Unregister = true;
+}
+
+/**
+ * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type)
+ */
+void TestGestureManager::Update(const Integration::GestureRequest& request)
+{
+ mFunctionsCalled.Update = true;
+}
+
+
+/** Call this every test */
+void TestGestureManager::Initialize()
+{
+ mFunctionsCalled.Reset();
+}
+
+bool TestGestureManager::WasCalled(TestFuncEnum func)
+{
+ switch(func)
+ {
+ case RegisterType: return mFunctionsCalled.Register;
+ case UnregisterType: return mFunctionsCalled.Unregister;
+ case UpdateType: return mFunctionsCalled.Update;
+ }
+ return false;
+}
+
+void TestGestureManager::ResetCallStatistics(TestFuncEnum func)
+{
+ switch(func)
+ {
+ case RegisterType: mFunctionsCalled.Register = false; break;
+ case UnregisterType: mFunctionsCalled.Unregister = false; break;
+ case UpdateType: mFunctionsCalled.Update = false; break;
+ }
+}
+
+TestGestureManager::TestFunctions::TestFunctions()
+: Register(false),
+ Unregister(false),
+ Update(false)
+{
+}
+
+void TestGestureManager::TestFunctions::Reset()
+{
+ Register = false;
+ Unregister = false;
+ Update = false;
+}
+
+
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TEST_GESTURE_MANAGER_H__
+#define __DALI_TEST_GESTURE_MANAGER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/gesture-manager.h>
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+
+/**
+ * Concrete implementation of the gesture manager class.
+ */
+class DALI_IMPORT_API TestGestureManager : public Dali::Integration::GestureManager
+{
+
+public:
+
+ /**
+ * Constructor
+ */
+ TestGestureManager();
+
+ /**
+ * Destructor
+ */
+ virtual ~TestGestureManager();
+
+ /**
+ * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type)
+ */
+ virtual void Register(const Integration::GestureRequest& request);
+
+ /**
+ * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type)
+ */
+ virtual void Unregister(const Integration::GestureRequest& request);
+
+ /**
+ * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type)
+ */
+ virtual void Update(const Integration::GestureRequest& request);
+
+public: // TEST FUNCTIONS
+
+ // Enumeration of Gesture Manager methods
+ enum TestFuncEnum
+ {
+ RegisterType,
+ UnregisterType,
+ UpdateType,
+ };
+
+ /** Call this every test */
+ void Initialize();
+ bool WasCalled(TestFuncEnum func);
+ void ResetCallStatistics(TestFuncEnum func);
+
+private:
+
+ struct TestFunctions
+ {
+ TestFunctions();
+ void Reset();
+
+ bool Register;
+ bool Unregister;
+ bool Update;
+ };
+
+ TestFunctions mFunctionsCalled;
+};
+
+} // Dali
+
+#endif // __DALI_TEST_GESTURE_MANAGER_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "test-gl-abstraction.h"
+
+namespace Dali
+{
+
+TestGlAbstraction::TestGlAbstraction()
+{
+ Initialize();
+}
+
+TestGlAbstraction::~TestGlAbstraction() {}
+
+void TestGlAbstraction::Initialize()
+{
+ mCurrentProgram = 0;
+ mCompileStatus = GL_TRUE;
+ mLinkStatus = GL_TRUE;
+
+ mGetAttribLocationResult = 0;
+ mGetErrorResult = 0;
+ mGetStringResult = NULL;
+ mIsBufferResult = 0;
+ mIsEnabledResult = 0;
+ mIsFramebufferResult = 0;
+ mIsProgramResult = 0;
+ mIsRenderbufferResult = 0;
+ mIsShaderResult = 0;
+ mIsTextureResult = 0;
+ mVertexAttribArrayChanged = false;
+
+ mCheckFramebufferStatusResult = 0;
+ mNumBinaryFormats = 1;
+ mBinaryFormats = 1;
+ mProgramBinaryLength = 0;
+
+ mLastAutoTextureIdUsed = 0;
+
+ mLastShaderIdUsed = 0;
+ mLastProgramIdUsed = 0;
+ mLastUniformIdUsed = 0;
+ mLastShaderCompiled = 0;
+
+ mLastBlendEquationRgb = 0;
+ mLastBlendEquationAlpha = 0;
+ mLastBlendFuncSrcRgb = 0;
+ mLastBlendFuncDstRgb = 0;
+ mLastBlendFuncSrcAlpha = 0;
+ mLastBlendFuncDstAlpha = 0;
+
+ mUniforms.clear();
+ mProgramUniforms1i.clear();
+ mProgramUniforms1f.clear();
+ mProgramUniforms2f.clear();
+ mProgramUniforms3f.clear();
+ mProgramUniforms4f.clear();
+}
+
+} // Namespace dali
+
+bool BlendEnabled(const Dali::TraceCallStack& callStack)
+{
+ std::stringstream out;
+ out << GL_BLEND;
+ bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
+ return blendEnabled;
+}
+
+bool BlendDisabled(const Dali::TraceCallStack& callStack)
+{
+ std::stringstream out;
+ out << GL_BLEND;
+ bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());
+ return blendEnabled;
+}
--- /dev/null
+#ifndef __TEST_GL_ABSTRACTION_H__
+#define __TEST_GL_ABSTRACTION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <sstream>
+#include <string>
+#include <map>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-core-capi-internal.h>
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/core.h>
+#include <dali/integration-api/gl-abstraction.h>
+#include "test-trace-call-stack.h"
+
+namespace Dali
+{
+
+static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 64;
+static const char *mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] =
+{
+ "aPosition", // ATTRIB_POSITION
+ "aNormal", // ATTRIB_NORMAL
+ "aTexCoord", // ATTRIB_TEXCOORD
+ "aColor", // ATTRIB_COLOR
+ "aBoneWeights", // ATTRIB_BONE_WEIGHTS
+ "aBoneIndices" // ATTRIB_BONE_INDICES
+};
+
+class DALI_IMPORT_API TestGlAbstraction: public Dali::Integration::GlAbstraction
+{
+public:
+ TestGlAbstraction();
+ ~TestGlAbstraction();
+ void Initialize();
+
+ /* OpenGL ES 2.0 */
+
+ inline void ActiveTexture( GLenum textureUnit )
+ {
+ mActiveTextureUnit = textureUnit - GL_TEXTURE0;
+ }
+
+ inline GLenum GetActiveTextureUnit() const
+ {
+ return mActiveTextureUnit + GL_TEXTURE0;
+ }
+
+ inline void AttachShader( GLuint program, GLuint shader )
+ {
+ std::stringstream out;
+ out << program << ", " << shader;
+ mShaderTrace.PushCall("AttachShader", out.str());
+ }
+
+ inline void BindAttribLocation( GLuint program, GLuint index, const char* name )
+ {
+ }
+
+ inline void BindBuffer( GLenum target, GLuint buffer )
+ {
+ }
+
+ inline void BindFramebuffer( GLenum target, GLuint framebuffer )
+ {
+ }
+
+ inline void BindRenderbuffer( GLenum target, GLuint renderbuffer )
+ {
+ }
+
+ /**
+ * This method can be used by test cases, to query the texture IDs that have been bound by BindTexture.
+ * @return A vector containing the IDs that were bound.
+ */
+ inline const std::vector<GLuint>& GetBoundTextures() const
+ {
+ return mBoundTextures;
+ }
+
+ /**
+ * Query the texture IDs that have been bound with BindTexture, with a specific active texture unit.
+ * @param[in] activeTextureUnit The specific active texture unit.
+ * @return A vector containing the IDs that were bound.
+ */
+ inline const std::vector<GLuint>& GetBoundTextures( GLuint activeTextureUnit ) const
+ {
+ return mActiveTextures[ activeTextureUnit - GL_TEXTURE0 ].mBoundTextures;
+ }
+
+ /**
+ * This method can be used by test cases, to clear the record of texture IDs that have been bound by BindTexture.
+ */
+ inline void ClearBoundTextures()
+ {
+ mBoundTextures.clear();
+
+ for( unsigned int i=0; i<MIN_TEXTURE_UNIT_LIMIT; ++i )
+ {
+ mActiveTextures[ i ].mBoundTextures.clear();
+ }
+ }
+
+ inline void BindTexture( GLenum target, GLuint texture )
+ {
+ // Record the bound textures for future checks
+ if( texture )
+ {
+ mBoundTextures.push_back( texture );
+
+ if( mActiveTextureUnit < MIN_TEXTURE_UNIT_LIMIT )
+ {
+ mActiveTextures[ mActiveTextureUnit ].mBoundTextures.push_back( texture );
+ }
+ }
+ }
+
+ inline void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+ {
+ mLastBlendColor.r = red;
+ mLastBlendColor.g = green;
+ mLastBlendColor.b = blue;
+ mLastBlendColor.a = alpha;
+ }
+
+ inline const Vector4& GetLastBlendColor() const
+ {
+ return mLastBlendColor;
+ }
+
+ inline void BlendEquation( GLenum mode )
+ {
+ mLastBlendEquationRgb = mode;
+ mLastBlendEquationAlpha = mode;
+ }
+
+ inline void BlendEquationSeparate( GLenum modeRgb, GLenum modeAlpha )
+ {
+ mLastBlendEquationRgb = modeRgb;
+ mLastBlendEquationAlpha = modeAlpha;
+ }
+
+ inline GLenum GetLastBlendEquationRgb() const
+ {
+ return mLastBlendEquationRgb;
+ }
+
+ inline GLenum GetLastBlendEquationAlpha() const
+ {
+ return mLastBlendEquationAlpha;
+ }
+
+ inline void BlendFunc(GLenum sfactor, GLenum dfactor)
+ {
+ mLastBlendFuncSrcRgb = sfactor;
+ mLastBlendFuncDstRgb = dfactor;
+ mLastBlendFuncSrcAlpha = sfactor;
+ mLastBlendFuncDstAlpha = dfactor;
+ }
+
+ inline void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+ {
+ mLastBlendFuncSrcRgb = srcRGB;
+ mLastBlendFuncDstRgb = dstRGB;
+ mLastBlendFuncSrcAlpha = srcAlpha;
+ mLastBlendFuncDstAlpha = dstAlpha;
+ }
+
+ inline GLenum GetLastBlendFuncSrcRgb() const
+ {
+ return mLastBlendFuncSrcRgb;
+ }
+
+ inline GLenum GetLastBlendFuncDstRgb() const
+ {
+ return mLastBlendFuncDstRgb;
+ }
+
+ inline GLenum GetLastBlendFuncSrcAlpha() const
+ {
+ return mLastBlendFuncSrcAlpha;
+ }
+
+ inline GLenum GetLastBlendFuncDstAlpha() const
+ {
+ return mLastBlendFuncDstAlpha;
+ }
+
+ inline void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
+ {
+ }
+
+ inline void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
+ {
+ }
+
+ inline GLenum CheckFramebufferStatus(GLenum target)
+ {
+ return mCheckFramebufferStatusResult;
+ }
+
+ inline void Clear(GLbitfield mask)
+ {
+ }
+
+ inline void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+ {
+ }
+
+ inline void ClearDepthf(GLclampf depth)
+ {
+ }
+
+ inline void ClearStencil(GLint s)
+ {
+ }
+
+ inline void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+ {
+ }
+
+ inline void CompileShader(GLuint shader)
+ {
+ std::stringstream out;
+ out << shader;
+ mShaderTrace.PushCall("CompileShader", out.str());
+ }
+
+ inline void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
+ {
+ }
+
+ inline void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
+ {
+ }
+
+ inline void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+ {
+ }
+
+ inline void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+ }
+
+ inline GLuint CreateProgram(void)
+ {
+ mShaderTrace.PushCall("CreateProgram", "");
+
+ ++mLastProgramIdUsed;
+ mUniforms[mLastProgramIdUsed] = UniformIDMap();
+ return mLastProgramIdUsed;
+ }
+
+ inline GLuint CreateShader(GLenum type)
+ {
+ std::stringstream out;
+ out << type;
+ mShaderTrace.PushCall("CreateShader", out.str());
+
+ return ++mLastShaderIdUsed;
+ }
+
+ inline void CullFace(GLenum mode)
+ {
+ std::stringstream out;
+ out << mode;
+ mCullFaceTrace.PushCall("CullFace", out.str());
+ }
+
+ inline void DeleteBuffers(GLsizei n, const GLuint* buffers)
+ {
+ }
+
+ inline void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+ {
+ }
+
+ inline void DeleteProgram(GLuint program)
+ {
+ std::stringstream out;
+ out << program;
+ mShaderTrace.PushCall("DeleteProgram", out.str());
+ }
+
+ inline void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+ {
+ }
+
+ inline void DeleteShader(GLuint shader)
+ {
+ std::stringstream out;
+ out << shader;
+ mShaderTrace.PushCall("DeleteShader", out.str());
+ }
+
+ inline void DeleteTextures(GLsizei n, const GLuint* textures)
+ {
+ std::stringstream out;
+ out << n << ", " << textures << " = [" ;
+
+ for(GLsizei i=0; i<n; i++)
+ {
+ out << textures[i] << ", " ;
+ mDeletedTextureIds.push_back(textures[i]);
+ }
+ out << "]";
+ mTextureTrace.PushCall("DeleteTextures", out.str());
+ }
+
+ inline bool CheckNoTexturesDeleted()
+ {
+ return mDeletedTextureIds.size() == 0;
+ }
+
+ inline bool CheckTextureDeleted( GLuint textureId )
+ {
+ bool found = false;
+
+ for(std::vector<GLuint>::iterator iter=mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter)
+ {
+ if(*iter == textureId)
+ {
+ found = true;
+ break;
+ }
+ }
+ return found;
+ }
+
+ inline void ClearDeletedTextures()
+ {
+ mDeletedTextureIds.clear();
+ }
+
+ inline void DepthFunc(GLenum func)
+ {
+ }
+
+ inline void DepthMask(GLboolean flag)
+ {
+ }
+
+ inline void DepthRangef(GLclampf zNear, GLclampf zFar)
+ {
+ }
+
+ inline void DetachShader(GLuint program, GLuint shader)
+ {
+ std::stringstream out;
+ out << program << ", " << shader;
+ mShaderTrace.PushCall("DetachShader", out.str());
+ }
+
+ inline void Disable(GLenum cap)
+ {
+ std::stringstream out;
+ out << cap;
+ mCullFaceTrace.PushCall("Disable", out.str());
+ }
+
+ inline void DisableVertexAttribArray(GLuint index)
+ {
+ SetVertexAttribArray( index, false );
+ }
+
+ inline void DrawArrays(GLenum mode, GLint first, GLsizei count)
+ {
+ std::stringstream out;
+ out << mode << ", " << first << ", " << count;
+ mDrawTrace.PushCall("DrawArrays", out.str());
+ }
+
+ inline void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
+ {
+ std::stringstream out;
+ out << mode << ", " << count << ", " << type << ", indices";
+ mDrawTrace.PushCall("DrawElements", out.str());
+ }
+
+ inline void Enable(GLenum cap)
+ {
+ std::stringstream out;
+ out << cap;
+ mCullFaceTrace.PushCall("Enable", out.str());
+ }
+
+ inline void EnableVertexAttribArray(GLuint index)
+ {
+ SetVertexAttribArray( index, true);
+ }
+
+ inline void Finish(void)
+ {
+ }
+
+ inline void Flush(void)
+ {
+ }
+
+ inline void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+ {
+ }
+
+ inline void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+ {
+ }
+
+ inline void FrontFace(GLenum mode)
+ {
+ }
+
+ inline void GenBuffers(GLsizei n, GLuint* buffers)
+ {
+ // avoids an assert in GpuBuffers
+ *buffers = 1u;
+ }
+
+ inline void GenerateMipmap(GLenum target)
+ {
+ }
+
+ inline void GenFramebuffers(GLsizei n, GLuint* framebuffers)
+ {
+ }
+
+ inline void GenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+ {
+ }
+
+ /**
+ * This method can be used by test cases, to manipulate the texture IDs generated by GenTextures.
+ * @param[in] ids A vector containing the next IDs to be generated
+ */
+ inline void SetNextTextureIds( const std::vector<GLuint>& ids )
+ {
+ mNextTextureIds = ids;
+ }
+
+ inline const std::vector<GLuint>& GetNextTextureIds()
+ {
+ return mNextTextureIds;
+ }
+
+ inline void GenTextures(GLsizei n, GLuint* textures)
+ {
+ for( int i=0; i<n; ++i )
+ {
+ if( !mNextTextureIds.empty() )
+ {
+ *(textures+i) = mNextTextureIds[0];
+ mNextTextureIds.erase( mNextTextureIds.begin() );
+ }
+ else
+ {
+ *(textures+i) = ++mLastAutoTextureIdUsed;
+ }
+ }
+ }
+
+ inline void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+ {
+ }
+
+ inline void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+ {
+ }
+
+ inline void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+ {
+ }
+
+ inline int GetAttribLocation(GLuint program, const char* name)
+ {
+ std::string attribName(name);
+
+ for( unsigned int i = 0; i < ATTRIB_TYPE_LAST; ++i )
+ {
+ if( mStdAttribs[i] == attribName )
+ {
+ return i;
+ }
+ }
+
+ // 0 is a valid location
+ return 0;
+ }
+
+ inline void GetBooleanv(GLenum pname, GLboolean* params)
+ {
+ }
+
+ inline void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+ {
+ }
+
+ inline GLenum GetError(void)
+ {
+ return mGetErrorResult;
+ }
+
+ inline void GetFloatv(GLenum pname, GLfloat* params)
+ {
+ }
+
+ inline void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+ {
+ }
+
+ inline void GetIntegerv(GLenum pname, GLint* params)
+ {
+ switch( pname )
+ {
+ case GL_MAX_TEXTURE_SIZE:
+ *params = 2048;
+ break;
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+ *params = 8;
+ break;
+ case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
+ *params = mNumBinaryFormats;
+ break;
+ case GL_PROGRAM_BINARY_FORMATS_OES:
+ *params = mBinaryFormats;
+ break;
+ }
+ }
+
+ inline void GetProgramiv(GLuint program, GLenum pname, GLint* params)
+ {
+ switch( pname ) {
+ case GL_LINK_STATUS:
+ *params = mLinkStatus;
+ break;
+ case GL_PROGRAM_BINARY_LENGTH_OES:
+ *params = mProgramBinaryLength;
+ break;
+ }
+ }
+
+ inline void GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+ {
+ }
+
+
+ inline void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+ {
+ }
+
+ inline void GetShaderiv(GLuint shader, GLenum pname, GLint* params)
+ {
+ switch( pname ) {
+ case GL_COMPILE_STATUS:
+ *params = mCompileStatus;
+ break;
+ }
+ }
+
+ inline void GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+ {
+ }
+
+ inline void GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+ {
+ }
+
+ inline const GLubyte* GetString(GLenum name)
+ {
+ return mGetStringResult;
+ }
+
+ inline void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+ {
+ }
+
+ inline void GetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+ {
+ }
+
+ inline void GetUniformfv(GLuint program, GLint location, GLfloat* params)
+ {
+ }
+
+ inline void GetUniformiv(GLuint program, GLint location, GLint* params)
+ {
+ }
+
+ inline GLint GetUniformLocation(GLuint program, const char* name)
+ {
+ ProgramUniformMap::iterator it = mUniforms.find(program);
+ if( it == mUniforms.end() )
+ {
+ // Not a valid program ID
+ mGetErrorResult = GL_INVALID_OPERATION;
+ return -1;
+ }
+
+ UniformIDMap& uniformIDs = it->second;
+ UniformIDMap::iterator it2 = uniformIDs.find( name );
+ if( it2 == uniformIDs.end() )
+ {
+ // Uniform not found, so add it...
+ uniformIDs[name] = ++mLastUniformIdUsed;
+ return mLastUniformIdUsed;
+ }
+
+ return it2->second;
+ }
+
+ inline void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+ {
+ }
+
+ inline void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+ {
+ }
+
+ inline void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
+ {
+ }
+
+ inline void Hint(GLenum target, GLenum mode)
+ {
+ }
+
+ inline GLboolean IsBuffer(GLuint buffer)
+ {
+ return mIsBufferResult;
+ }
+
+ inline GLboolean IsEnabled(GLenum cap)
+ {
+ return mIsEnabledResult;
+ }
+
+ inline GLboolean IsFramebuffer(GLuint framebuffer)
+ {
+ return mIsFramebufferResult;
+ }
+
+ inline GLboolean IsProgram(GLuint program)
+ {
+ return mIsProgramResult;
+ }
+
+ inline GLboolean IsRenderbuffer(GLuint renderbuffer)
+ {
+ return mIsRenderbufferResult;
+ }
+
+ inline GLboolean IsShader(GLuint shader)
+ {
+ return mIsShaderResult;
+ }
+
+ inline GLboolean IsTexture(GLuint texture)
+ {
+ return mIsTextureResult;
+ }
+
+ inline void LineWidth(GLfloat width)
+ {
+ }
+
+ inline void LinkProgram(GLuint program)
+ {
+ std::stringstream out;
+ out << program;
+ mShaderTrace.PushCall("LinkProgram", out.str());
+ }
+
+ inline void PixelStorei(GLenum pname, GLint param)
+ {
+ }
+
+ inline void PolygonOffset(GLfloat factor, GLfloat units)
+ {
+ }
+
+ inline void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
+ {
+ }
+
+ inline void ReleaseShaderCompiler(void)
+ {
+ }
+
+ inline void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+ {
+ }
+
+ inline void SampleCoverage(GLclampf value, GLboolean invert)
+ {
+ }
+
+ inline void Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+ }
+
+ inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
+ {
+ }
+
+ inline void ShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
+ {
+ std::string stringBuilder;
+ for(int i = 0; i < count; ++i)
+ {
+ stringBuilder += string[i];
+ }
+ mShaderSources[shader] = stringBuilder;
+ mLastShaderCompiled = shader;
+ }
+
+ inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+ {
+ const std::string shaderSource = mShaderSources[shader];
+ if( static_cast<int>(shaderSource.length()) < bufsize )
+ {
+ strcpy(source, shaderSource.c_str());
+ *length = shaderSource.length();
+ }
+ else
+ {
+ *length = bufsize -1;
+ strncpy(source, shaderSource.c_str(), *length);
+ source[*length] = 0x0;
+ }
+ }
+
+ inline void StencilFunc(GLenum func, GLint ref, GLuint mask)
+ {
+ }
+
+ inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+ {
+ }
+
+ inline void StencilMask(GLuint mask)
+ {
+ }
+
+ inline void StencilMaskSeparate(GLenum face, GLuint mask)
+ {
+ }
+
+ inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+ {
+ }
+
+ inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+ {
+ }
+
+ inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
+ {
+ std::stringstream out;
+ out << width << ", " << height;
+ mTextureTrace.PushCall("TexImage2D", out.str());
+ }
+
+ inline void TexParameterf(GLenum target, GLenum pname, GLfloat param)
+ {
+ }
+
+ inline void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+ {
+ }
+
+ inline void TexParameteri(GLenum target, GLenum pname, GLint param)
+ {
+ }
+
+ inline void TexParameteriv(GLenum target, GLenum pname, const GLint* params)
+ {
+ }
+
+ inline void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
+ {
+ std::stringstream out;
+ out << xoffset << ", " << yoffset << ", " << width << ", " << height;
+ mTextureTrace.PushCall("TexSubImage2D", out.str());
+ }
+
+ inline void Uniform1f(GLint location, GLfloat x)
+ {
+ if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, x ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ }
+ }
+
+ inline void Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
+ {
+ for( int i = 0; i < count; ++i )
+ {
+ if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, v[i] ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ break;
+ }
+ }
+ }
+
+ inline void Uniform1i(GLint location, GLint x)
+ {
+ if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, location, x ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ }
+ }
+
+ inline void Uniform1iv(GLint location, GLsizei count, const GLint* v)
+ {
+ for( int i = 0; i < count; ++i )
+ {
+ if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram,
+ location,
+ v[i] ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ break;
+ }
+ }
+ }
+
+ inline void Uniform2f(GLint location, GLfloat x, GLfloat y)
+ {
+ if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
+ location,
+ Vector2( x, y ) ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ }
+ }
+
+ inline void Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
+ {
+ for( int i = 0; i < count; ++i )
+ {
+ if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
+ location,
+ Vector2( v[2*i], v[2*i+1] ) ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ break;
+ }
+ }
+ }
+
+ inline void Uniform2i(GLint location, GLint x, GLint y)
+ {
+ }
+
+ inline void Uniform2iv(GLint location, GLsizei count, const GLint* v)
+ {
+ }
+
+ inline void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+ {
+ if( ! mProgramUniforms3f.SetUniformValue( mCurrentProgram,
+ location,
+ Vector3( x, y, z ) ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ }
+ }
+
+ inline void Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
+ {
+ for( int i = 0; i < count; ++i )
+ {
+ if( ! mProgramUniforms3f.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Vector3( v[3*i], v[3*i+1], v[3*i+2] ) ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ break;
+ }
+ }
+ }
+
+ inline void Uniform3i(GLint location, GLint x, GLint y, GLint z)
+ {
+ }
+
+ inline void Uniform3iv(GLint location, GLsizei count, const GLint* v)
+ {
+ }
+
+ inline void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+ {
+ if( ! mProgramUniforms4f.SetUniformValue( mCurrentProgram,
+ location,
+ Vector4( x, y, z, w ) ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ }
+ }
+
+ inline void Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
+ {
+ for( int i = 0; i < count; ++i )
+ {
+ if( ! mProgramUniforms4f.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Vector4( v[4*i], v[4*i+1], v[4*i+2], v[4*i+3] ) ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ break;
+ }
+ }
+ }
+
+ inline void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+ {
+ }
+
+ inline void Uniform4iv(GLint location, GLsizei count, const GLint* v)
+ {
+ }
+
+ inline void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ }
+
+ inline void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ for( int i = 0; i < count; ++i )
+ {
+ if( ! mProgramUniformsMat3.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Matrix3( value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8] ) ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ break;
+ }
+ }
+ }
+
+ inline void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ for( int i = 0; i < count; ++i )
+ {
+ if( ! mProgramUniformsMat4.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Matrix( value ) ) )
+ {
+ mGetErrorResult = GL_INVALID_OPERATION;
+ break;
+ }
+ }
+ }
+
+ inline void UseProgram(GLuint program)
+ {
+ mCurrentProgram = program;
+ }
+
+ inline void ValidateProgram(GLuint program)
+ {
+ }
+
+ inline void VertexAttrib1f(GLuint indx, GLfloat x)
+ {
+ }
+
+ inline void VertexAttrib1fv(GLuint indx, const GLfloat* values)
+ {
+ }
+
+ inline void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+ {
+ }
+
+ inline void VertexAttrib2fv(GLuint indx, const GLfloat* values)
+ {
+ }
+
+ inline void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+ {
+ }
+
+ inline void VertexAttrib3fv(GLuint indx, const GLfloat* values)
+ {
+ }
+
+ inline void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+ {
+ }
+
+ inline void VertexAttrib4fv(GLuint indx, const GLfloat* values)
+ {
+ }
+
+ inline void VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
+ {
+ }
+
+ inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+ }
+
+ /* OpenGL ES 3.0 */
+
+ inline void ReadBuffer(GLenum mode)
+ {
+ }
+
+ inline void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
+ {
+ }
+
+ inline void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+ {
+ }
+
+ inline void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
+ {
+ }
+
+ inline void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+ }
+
+ inline void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
+ {
+ }
+
+ inline void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
+ {
+ }
+
+ inline void GenQueries(GLsizei n, GLuint* ids)
+ {
+ }
+
+ inline void DeleteQueries(GLsizei n, const GLuint* ids)
+ {
+ }
+
+ inline GLboolean IsQuery(GLuint id)
+ {
+ return false;
+ }
+
+ inline void BeginQuery(GLenum target, GLuint id)
+ {
+ }
+
+ inline void EndQuery(GLenum target)
+ {
+ }
+
+ inline void GetQueryiv(GLenum target, GLenum pname, GLint* params)
+ {
+ }
+
+ inline void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+ {
+ }
+
+ inline GLboolean UnmapBuffer(GLenum target)
+ {
+ return false;
+ }
+
+ inline void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
+ {
+ }
+
+ inline void DrawBuffers(GLsizei n, const GLenum* bufs)
+ {
+ }
+
+ inline void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ }
+
+ inline void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ }
+
+ inline void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ }
+
+ inline void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ }
+
+ inline void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ }
+
+ inline void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ }
+
+ inline void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+ {
+ }
+
+ inline void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+ {
+ }
+
+ inline void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+ {
+ }
+
+ inline GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+ {
+ return NULL;
+ }
+
+ inline void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+ {
+ }
+
+ inline void BindVertexArray(GLuint array)
+ {
+ }
+
+ inline void DeleteVertexArrays(GLsizei n, const GLuint* arrays)
+ {
+ }
+
+ inline void GenVertexArrays(GLsizei n, GLuint* arrays)
+ {
+ }
+
+ inline GLboolean IsVertexArray(GLuint array)
+ {
+ return false;
+ }
+
+ inline void GetIntegeri_v(GLenum target, GLuint index, GLint* data)
+ {
+ }
+
+ inline void BeginTransformFeedback(GLenum primitiveMode)
+ {
+ }
+
+ inline void EndTransformFeedback(void)
+ {
+ }
+
+ inline void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+ {
+ }
+
+ inline void BindBufferBase(GLenum target, GLuint index, GLuint buffer)
+ {
+ }
+
+ inline void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+ {
+ }
+
+ inline void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
+ {
+ }
+
+ inline void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+ {
+ }
+
+ inline void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
+ {
+ }
+
+ inline void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
+ {
+ }
+
+ inline void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+ {
+ }
+
+ inline void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+ {
+ }
+
+ inline void VertexAttribI4iv(GLuint index, const GLint* v)
+ {
+ }
+
+ inline void VertexAttribI4uiv(GLuint index, const GLuint* v)
+ {
+ }
+
+ inline void GetUniformuiv(GLuint program, GLint location, GLuint* params)
+ {
+ }
+
+ inline GLint GetFragDataLocation(GLuint program, const GLchar *name)
+ {
+ return -1;
+ }
+
+ inline void Uniform1ui(GLint location, GLuint v0)
+ {
+ }
+
+ inline void Uniform2ui(GLint location, GLuint v0, GLuint v1)
+ {
+ }
+
+ inline void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+ {
+ }
+
+ inline void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+ {
+ }
+
+ inline void Uniform1uiv(GLint location, GLsizei count, const GLuint* value)
+ {
+ }
+
+ inline void Uniform2uiv(GLint location, GLsizei count, const GLuint* value)
+ {
+ }
+
+ inline void Uniform3uiv(GLint location, GLsizei count, const GLuint* value)
+ {
+ }
+
+ inline void Uniform4uiv(GLint location, GLsizei count, const GLuint* value)
+ {
+ }
+
+ inline void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
+ {
+ }
+
+ inline void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
+ {
+ }
+
+ inline void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
+ {
+ }
+
+ inline void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+ {
+ }
+
+ inline const GLubyte* GetStringi(GLenum name, GLuint index)
+ {
+ return NULL;
+ }
+
+ inline void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+ {
+ }
+
+ inline void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
+ {
+ }
+
+ inline void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+ {
+ }
+
+ inline GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+ {
+ return GL_INVALID_INDEX;
+ }
+
+ inline void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+ {
+ }
+
+ inline void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
+ {
+ }
+
+ inline void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+ {
+ }
+
+ inline void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+ {
+ }
+
+ inline void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
+ {
+ }
+
+ inline GLsync FenceSync(GLenum condition, GLbitfield flags)
+ {
+ return NULL;
+ }
+
+ inline GLboolean IsSync(GLsync sync)
+ {
+ return false;
+ }
+
+ inline void DeleteSync(GLsync sync)
+ {
+ }
+
+ inline GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+ {
+ return 0;
+ }
+
+ inline void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+ {
+ }
+
+ inline void GetInteger64v(GLenum pname, GLint64* params)
+ {
+ }
+
+ inline void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
+ {
+ }
+
+ inline void GetInteger64i_v(GLenum target, GLuint index, GLint64* data)
+ {
+ }
+
+ inline void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
+ {
+ }
+
+ inline void GenSamplers(GLsizei count, GLuint* samplers)
+ {
+ }
+
+ inline void DeleteSamplers(GLsizei count, const GLuint* samplers)
+ {
+ }
+
+ inline GLboolean IsSampler(GLuint sampler)
+ {
+ return false;
+ }
+
+ inline void BindSampler(GLuint unit, GLuint sampler)
+ {
+ }
+
+ inline void SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+ {
+ }
+
+ inline void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+ {
+ }
+
+ inline void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+ {
+ }
+
+ inline void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
+ {
+ }
+
+ inline void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+ {
+ }
+
+ inline void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+ {
+ }
+
+ inline void VertexAttribDivisor(GLuint index, GLuint divisor)
+ {
+ }
+
+ inline void BindTransformFeedback(GLenum target, GLuint id)
+ {
+ }
+
+ inline void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+ {
+ }
+
+ inline void GenTransformFeedbacks(GLsizei n, GLuint* ids)
+ {
+ }
+
+ inline GLboolean IsTransformFeedback(GLuint id)
+ {
+ return false;
+ }
+
+ inline void PauseTransformFeedback(void)
+ {
+ }
+
+ inline void ResumeTransformFeedback(void)
+ {
+ }
+
+ inline void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+ {
+ }
+
+ inline void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
+ {
+ }
+
+ inline void ProgramParameteri(GLuint program, GLenum pname, GLint value)
+ {
+ }
+
+ inline void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+ {
+ }
+
+ inline void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+ }
+
+ inline void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+ {
+ }
+
+ inline void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+ {
+ }
+
+ inline void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+ {
+ }
+
+public: // TEST FUNCTIONS
+ inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; }
+ inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; }
+ inline void SetGetAttribLocationResult( int result) { mGetAttribLocationResult = result; }
+ inline void SetGetErrorResult( GLenum result) { mGetErrorResult = result; }
+ inline void SetGetStringResult( GLubyte* result) { mGetStringResult = result; }
+ inline void SetIsBufferResult( GLboolean result) { mIsBufferResult = result; }
+ inline void SetIsEnabledResult( GLboolean result) { mIsEnabledResult = result; }
+ inline void SetIsFramebufferResult( GLboolean result) { mIsFramebufferResult = result; }
+ inline void SetIsProgramResult( GLboolean result) { mIsProgramResult = result; }
+ inline void SetIsRenderbufferResult( GLboolean result) { mIsRenderbufferResult = result; }
+ inline void SetIsShaderResult( GLboolean result) { mIsShaderResult = result; }
+ inline void SetIsTextureResult( GLboolean result) { mIsTextureResult = result; }
+ inline void SetCheckFramebufferStatusResult( GLenum result) { mCheckFramebufferStatusResult = result; }
+ inline void SetNumBinaryFormats( GLint numFormats ) { mNumBinaryFormats = numFormats; }
+ inline void SetBinaryFormats( GLint binaryFormats ) { mBinaryFormats = binaryFormats; }
+ inline void SetProgramBinaryLength( GLint length ) { mProgramBinaryLength = length; }
+
+ inline bool GetVertexAttribArrayState(GLuint index)
+ {
+ if( index >= MAX_ATTRIBUTE_CACHE_SIZE )
+ {
+ // out of range
+ return false;
+ }
+ return mVertexAttribArrayState[ index ];
+ }
+ inline void ClearVertexAttribArrayChanged() { mVertexAttribArrayChanged = false; }
+ inline bool GetVertexAttribArrayChanged() { return mVertexAttribArrayChanged; }
+
+ //Methods for CullFace verification
+ inline void EnableCullFaceCallTrace(bool enable) { mCullFaceTrace.Enable(enable); }
+ inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); }
+ inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; }
+
+ //Methods for Shader verification
+ inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); }
+ inline void ResetShaderCallStack() { mShaderTrace.Reset(); }
+ inline TraceCallStack& GetShaderTrace() { return mShaderTrace; }
+
+ //Methods for Texture verification
+ inline void EnableTextureCallTrace(bool enable) { mTextureTrace.Enable(enable); }
+ inline void ResetTextureCallStack() { mTextureTrace.Reset(); }
+ inline TraceCallStack& GetTextureTrace() { return mTextureTrace; }
+
+ //Methods for Draw verification
+ inline void EnableDrawCallTrace(bool enable) { mDrawTrace.Enable(enable); }
+ inline void ResetDrawCallStack() { mDrawTrace.Reset(); }
+ inline TraceCallStack& GetDrawTrace() { return mDrawTrace; }
+
+ template <typename T>
+ inline bool CheckUniformValue( const char* name, const T& value ) const
+ {
+ for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it )
+ {
+ const UniformIDMap &uniformIDs = program_it->second;
+
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
+ if( uniform_it != uniformIDs.end() )
+ {
+ // found one matching uniform name, lets check the value...
+ GLuint programId = program_it->first;
+ GLint uniformId = uniform_it->second;
+
+ const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
+ if( mProgramUniforms.CheckUniformValue( programId, uniformId, value ) )
+ {
+ // the value matches
+ return true;
+ }
+ }
+ }
+
+ fprintf(stderr, "Not found, printing possible values:" );
+ for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it )
+ {
+ const UniformIDMap &uniformIDs = program_it->second;
+
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
+ if( uniform_it != uniformIDs.end() )
+ {
+ // found one matching uniform name, lets check the value...
+ GLuint programId = program_it->first;
+ GLint uniformId = uniform_it->second;
+
+ const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
+ T origValue;
+ if ( mProgramUniforms.GetUniformValue(programId, uniformId, origValue) )
+ {
+ std::stringstream out;
+ out << uniform_it->first << ": " << origValue;
+ fprintf(stderr, "%s", out.str().c_str() );
+ }
+ }
+ }
+ return false;
+ }
+
+ template <typename T>
+ inline bool GetUniformValue( GLuint programId, GLuint uniformId, T& outValue) const
+ {
+ const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( outValue );
+ return mProgramUniforms.GetUniformValue( programId, uniformId, outValue );
+ }
+
+ inline bool GetUniformIds( const char* name, GLuint& programId, GLuint& uniformId ) const
+ {
+ for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it )
+ {
+ const UniformIDMap &uniformIDs = program_it->second;
+
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
+ if( uniform_it != uniformIDs.end() )
+ {
+ programId = program_it->first;
+ uniformId = uniform_it->second;
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+
+ inline GLuint GetLastShaderCompiled() const
+ {
+ return mLastShaderCompiled;
+ }
+
+ inline GLuint GetLastProgramCreated() const
+ {
+ return mLastProgramIdUsed;
+ }
+
+ enum AttribType
+ {
+ ATTRIB_UNKNOWN = -1,
+ ATTRIB_POSITION,
+ ATTRIB_NORMAL,
+ ATTRIB_TEXCOORD,
+ ATTRIB_COLOR,
+ ATTRIB_BONE_WEIGHTS,
+ ATTRIB_BONE_INDICES,
+ ATTRIB_TYPE_LAST
+ };
+
+
+private:
+ GLuint mCurrentProgram;
+ GLuint mCompileStatus;
+ GLuint mLinkStatus;
+ GLint mGetAttribLocationResult;
+ GLenum mGetErrorResult;
+ GLubyte* mGetStringResult;
+ GLboolean mIsBufferResult;
+ GLboolean mIsEnabledResult;
+ GLboolean mIsFramebufferResult;
+ GLboolean mIsProgramResult;
+ GLboolean mIsRenderbufferResult;
+ GLboolean mIsShaderResult;
+ GLboolean mIsTextureResult;
+ GLenum mActiveTextureUnit;
+ GLenum mCheckFramebufferStatusResult;
+ GLint mNumBinaryFormats;
+ GLint mBinaryFormats;
+ GLint mProgramBinaryLength;
+ bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE];
+ bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed
+ typedef std::map< GLuint, std::string> ShaderSourceMap;
+ ShaderSourceMap mShaderSources;
+ GLuint mLastShaderCompiled;
+
+ Vector4 mLastBlendColor;
+ GLenum mLastBlendEquationRgb;
+ GLenum mLastBlendEquationAlpha;
+ GLenum mLastBlendFuncSrcRgb;
+ GLenum mLastBlendFuncDstRgb;
+ GLenum mLastBlendFuncSrcAlpha;
+ GLenum mLastBlendFuncDstAlpha;
+
+ // Data for manipulating the IDs returned by GenTextures
+ GLuint mLastAutoTextureIdUsed;
+ std::vector<GLuint> mNextTextureIds;
+ std::vector<GLuint> mDeletedTextureIds;
+ std::vector<GLuint> mBoundTextures;
+
+ struct ActiveTextureType
+ {
+ std::vector<GLuint> mBoundTextures;
+ };
+
+ ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ];
+
+ TraceCallStack mCullFaceTrace;
+ TraceCallStack mShaderTrace;
+ TraceCallStack mTextureTrace;
+ TraceCallStack mDrawTrace;
+
+ // Shaders & Uniforms
+ GLuint mLastShaderIdUsed;
+ GLuint mLastProgramIdUsed;
+ GLuint mLastUniformIdUsed;
+ typedef std::map< std::string, GLint > UniformIDMap;
+ typedef std::map< GLuint, UniformIDMap > ProgramUniformMap;
+ ProgramUniformMap mUniforms;
+
+ template <typename T>
+ struct ProgramUniformValue : public std::map< GLuint, std::map< GLint, T > >
+ {
+ public:
+ typedef std::map< GLint, T > UniformValueMap;
+ typedef std::map< GLuint, UniformValueMap > Map;
+
+ bool SetUniformValue( GLuint program, GLuint uniform, const T& value )
+ {
+ if( program == 0 )
+ {
+ return false;
+ }
+
+ typename Map::iterator it = Map::find( program );
+ if( it == Map::end() )
+ {
+ // if its the first uniform for this program add it
+ std::pair< typename Map::iterator, bool > result =
+ Map::insert( typename Map::value_type( program, UniformValueMap() ) );
+ it = result.first;
+ }
+
+ UniformValueMap& uniforms = it->second;
+ uniforms[uniform] = value;
+
+ return true;
+ }
+
+ bool CheckUniformValue( GLuint program, GLuint uniform, const T& value ) const
+ {
+ T uniformValue;
+ if ( GetUniformValue( program, uniform, uniformValue ) )
+ {
+ return value == uniformValue;
+ }
+
+ return false;
+ }
+
+ bool GetUniformValue( GLuint program, GLuint uniform, T& value ) const
+ {
+ if( program == 0 )
+ {
+ return false;
+ }
+
+ typename Map::const_iterator it = Map::find( program );
+ if( it == Map::end() )
+ {
+ // Uniform values always initialised as 0
+ value = GetZero();
+ return true;
+ }
+
+ const UniformValueMap& uniforms = it->second;
+ typename UniformValueMap::const_iterator it2 = uniforms.find( uniform );
+ if( it2 == uniforms.end() )
+ {
+ // Uniform values always initialised as 0
+ value = GetZero();
+ return true;
+ }
+ value = it2->second;
+
+ return true;
+ }
+
+ T GetZero() const;
+ };
+ ProgramUniformValue<int> mProgramUniforms1i;
+ ProgramUniformValue<float> mProgramUniforms1f;
+ ProgramUniformValue<Vector2> mProgramUniforms2f;
+ ProgramUniformValue<Vector3> mProgramUniforms3f;
+ ProgramUniformValue<Vector4> mProgramUniforms4f;
+ ProgramUniformValue<Matrix> mProgramUniformsMat4;
+ ProgramUniformValue<Matrix3> mProgramUniformsMat3;
+
+ inline const ProgramUniformValue<int>& GetProgramUniformsForType( const int ) const
+ {
+ return mProgramUniforms1i;
+ }
+ inline const ProgramUniformValue<float>& GetProgramUniformsForType( const float ) const
+ {
+ return mProgramUniforms1f;
+ }
+ inline const ProgramUniformValue<Vector2>& GetProgramUniformsForType( const Vector2& ) const
+ {
+ return mProgramUniforms2f;
+ }
+ inline const ProgramUniformValue<Vector3>& GetProgramUniformsForType( const Vector3& ) const
+ {
+ return mProgramUniforms3f;
+ }
+ inline const ProgramUniformValue<Vector4>& GetProgramUniformsForType( const Vector4& ) const
+ {
+ return mProgramUniforms4f;
+ }
+ inline const ProgramUniformValue<Matrix>& GetProgramUniformsForType( const Matrix& ) const
+ {
+ return mProgramUniformsMat4;
+ }
+ inline const ProgramUniformValue<Matrix3>& GetProgramUniformsForType( const Matrix3& ) const
+ {
+ return mProgramUniformsMat3;
+ }
+ inline void SetVertexAttribArray(GLuint index, bool state)
+ {
+ if( index >= MAX_ATTRIBUTE_CACHE_SIZE )
+ {
+ // out of range
+ return;
+ }
+ mVertexAttribArrayState[ index ] = state;
+ mVertexAttribArrayChanged = true;
+ }
+};
+
+template <>
+inline int TestGlAbstraction::ProgramUniformValue<int>::GetZero() const
+{
+ return 0;
+}
+
+template <>
+inline float TestGlAbstraction::ProgramUniformValue<float>::GetZero() const
+{
+ return 0.0f;
+}
+
+template <>
+inline Vector2 TestGlAbstraction::ProgramUniformValue<Vector2>::GetZero() const
+{
+ return Vector2::ZERO;
+}
+
+template <>
+inline Vector3 TestGlAbstraction::ProgramUniformValue<Vector3>::GetZero() const
+{
+ return Vector3::ZERO;
+}
+
+template <>
+inline Vector4 TestGlAbstraction::ProgramUniformValue<Vector4>::GetZero() const
+{
+ return Vector4::ZERO;
+}
+
+template <>
+inline Matrix TestGlAbstraction::ProgramUniformValue<Matrix>::GetZero() const
+{
+ return Matrix();
+}
+
+template <>
+inline Matrix3 TestGlAbstraction::ProgramUniformValue<Matrix3>::GetZero() const
+{
+ return Matrix3( Matrix() );
+}
+
+} // namespace Dali
+
+bool BlendEnabled(const Dali::TraceCallStack& callStack);
+bool BlendDisabled(const Dali::TraceCallStack& callStack);
+
+
+
+
+#endif // __TEST_GL_ES_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "test-gl-sync-abstraction.h"
+
+namespace Dali
+{
+
+TestSyncObject::TestSyncObject(TraceCallStack& trace)
+: synced(false),
+ mTrace(trace)
+{
+}
+
+TestSyncObject::~TestSyncObject()
+{
+}
+
+bool TestSyncObject::IsSynced()
+{
+ mTrace.PushCall("SyncObject::IsSynced", ""); // Trace the method
+ return synced;
+}
+
+
+
+TestGlSyncAbstraction::TestGlSyncAbstraction()
+{
+ Initialize();
+}
+
+/**
+ * Destructor
+ */
+TestGlSyncAbstraction::~TestGlSyncAbstraction()
+{
+ for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
+ {
+ delete *iter;
+ }
+}
+
+/**
+ * Initialize the sync objects - clear down the map
+ */
+void TestGlSyncAbstraction::Initialize()
+{
+ mSyncObjects.clear();
+}
+
+/**
+ * Create a sync object
+ * @return the sync object
+ */
+Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject( )
+{
+ mTrace.PushCall("CreateSyncObject", ""); // Trace the method
+
+ TestSyncObject* syncObject = new TestSyncObject(mTrace);
+ mSyncObjects.push_back( syncObject );
+ return syncObject;
+}
+
+/**
+ * Destroy a sync object
+ * @param[in] syncObject The object to destroy
+ */
+void TestGlSyncAbstraction::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject )
+{
+ std::stringstream out;
+ out << syncObject;
+ mTrace.PushCall("DestroySyncObject", out.str()); // Trace the method
+
+ for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
+ {
+ if( *iter == syncObject )
+ {
+ delete *iter;
+ mSyncObjects.erase(iter);
+ break;
+ }
+ }
+}
+
+
+Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject( )
+{
+ if( !mSyncObjects.empty() )
+ {
+ return mSyncObjects.back();
+ }
+ return NULL;
+}
+
+/**
+ * Test method to trigger the object sync behaviour.
+ * @param[in]
+ * @param[in] sync The sync value to set
+ */
+void TestGlSyncAbstraction::SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync )
+{
+ TestSyncObject* testSyncObject = static_cast<TestSyncObject*>(syncObject);
+ testSyncObject->synced = sync;
+}
+
+/**
+ * Turn trace on
+ */
+void TestGlSyncAbstraction::EnableTrace(bool enable) { mTrace.Enable(enable); }
+
+/**
+ * Reset the trace callstack
+ */
+void TestGlSyncAbstraction::ResetTrace() { mTrace.Reset(); }
+
+/**
+ * Get the trace object (allows test case to find methods on it)
+ */
+TraceCallStack& TestGlSyncAbstraction::GetTrace() { return mTrace; }
+
+
+} // Dali
--- /dev/null
+#ifndef __TEST_GL_SYNC_ABSTRACTION_H__
+#define __TEST_GL_SYNC_ABSTRACTION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <sstream>
+#include <string>
+#include <map>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/core.h>
+#include <dali/integration-api/gl-sync-abstraction.h>
+#include "test-trace-call-stack.h"
+
+namespace Dali
+{
+
+class DALI_IMPORT_API TestSyncObject : public Integration::GlSyncAbstraction::SyncObject
+{
+public:
+ TestSyncObject(TraceCallStack& trace);
+ ~TestSyncObject();
+ bool IsSynced();
+ bool synced;
+ TraceCallStack& mTrace;
+};
+
+/**
+ * Class to emulate the GL sync functions with tracing
+ */
+class DALI_IMPORT_API TestGlSyncAbstraction: public Integration::GlSyncAbstraction
+{
+public:
+ /**
+ * Constructor
+ */
+ TestGlSyncAbstraction();
+
+ /**
+ * Destructor
+ */
+ ~TestGlSyncAbstraction();
+
+ /**
+ * Initialize the sync objects - clear down the map
+ */
+ void Initialize();
+
+ /**
+ * Create a sync object
+ * @return the sync object
+ */
+ virtual Integration::GlSyncAbstraction::SyncObject* CreateSyncObject( );
+
+ /**
+ * Destroy a sync object
+ * @param[in] syncObject The object to destroy
+ */
+ virtual void DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject );
+
+
+public: // TEST FUNCTIONS
+ Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject( );
+
+ /**
+ * Test method to trigger the object sync behaviour.
+ * @param[in]
+ * @param[in] sync The sync value to set
+ */
+ void SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync );
+
+ /**
+ * Turn trace on
+ */
+ void EnableTrace(bool enable);
+
+ /**
+ * Reset the trace callstack
+ */
+ void ResetTrace();
+
+ /**
+ * Get the trace object (allows test case to find methods on it)
+ */
+ TraceCallStack& GetTrace();
+
+private:
+ typedef std::vector<TestSyncObject*> SyncContainer;
+ typedef SyncContainer::iterator SyncIter;
+ SyncContainer mSyncObjects; ///< The sync objects
+ TraceCallStack mTrace; ///< the trace call stack for testing
+};
+
+} // Dali
+
+#endif // __TEST_GL_SYNC_ABSTRACTION_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#include "test-application.h"
+#include "test-native-image.h"
+
+
+namespace Dali
+{
+
+TestNativeImagePointer TestNativeImage::New(int width, int height)
+{
+ return new TestNativeImage(width, height);
+}
+
+TestNativeImage::TestNativeImage(int width, int height)
+: mWidth(width), mHeight(height)
+{
+}
+
+TestNativeImage::~TestNativeImage()
+{
+}
+
+} // namespace dali
--- /dev/null
+#ifndef __TEST_NATIVE_IMAGE_H__
+#define __TEST_NATIVE_IMAGE_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali/public-api/images/native-image.h>
+
+namespace Dali
+{
+class TestNativeImage;
+typedef IntrusivePtr<TestNativeImage> TestNativeImagePointer;
+
+class DALI_IMPORT_API TestNativeImage : public Dali::NativeImage
+{
+public:
+ static TestNativeImagePointer New(int width, int height);
+
+ inline virtual bool GlExtensionCreate() {return true;};
+ inline virtual void GlExtensionDestroy() {};
+ inline virtual GLenum TargetTexture() {return 1;};
+ inline virtual void PrepareTexture() {};
+ inline virtual unsigned int GetWidth() const {return mWidth;};
+ inline virtual unsigned int GetHeight() const {return mHeight;};
+ inline virtual Pixel::Format GetPixelFormat() const {return Pixel::RGBA8888;};
+
+private:
+ TestNativeImage(int width, int height);
+ virtual ~TestNativeImage();
+
+ int mWidth;
+ int mHeight;
+};
+
+} // Dali
+
+#endif
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "test-platform-abstraction.h"
+#include "dali-test-suite-utils.h"
+#include <dali/integration-api/bitmap.h>
+
+namespace Dali
+{
+
+/**
+ * Constructor
+ */
+TestPlatformAbstraction::TestPlatformAbstraction()
+: mRequest(0)
+{
+ Initialize();
+}
+
+/**
+ * Destructor
+ */
+TestPlatformAbstraction::~TestPlatformAbstraction()
+{
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetTimeMicroseconds()
+ */
+void TestPlatformAbstraction::GetTimeMicroseconds(unsigned int &seconds, unsigned int µSeconds)
+{
+ seconds = mSeconds;
+ microSeconds = mMicroSeconds;
+ mTrace.PushCall("GetTimeMicroseconds", "");
+}
+
+/**
+ * @copydoc PlatformAbstraction::Suspend()
+ */
+void TestPlatformAbstraction::Suspend()
+{
+ mTrace.PushCall("Suspend", "");
+}
+
+/**
+ * @copydoc PlatformAbstraction::Resume()
+ */
+void TestPlatformAbstraction::Resume()
+{
+ mTrace.PushCall("Resume", "");
+}
+
+void TestPlatformAbstraction::GetClosestImageSize( const std::string& filename,
+ const ImageAttributes& attributes,
+ Vector2& closestSize)
+{
+ closestSize = mClosestSize;
+ mTrace.PushCall("GetClosestImageSize", "");
+}
+
+void TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
+ const ImageAttributes& attributes,
+ Vector2& closestSize)
+{
+ closestSize = mClosestSize;
+ mTrace.PushCall("GetClosestImageSize", "");
+}
+
+
+/**
+ * @copydoc PlatformAbstraction::LoadResource()
+ */
+void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
+{
+ mTrace.PushCall("LoadResource", "");
+ if(mRequest != NULL)
+ {
+ delete mRequest;
+ tet_infoline ("Warning: multiple resource requests not handled by Test Suite. You may see unexpected errors");
+ }
+ mRequest = new Integration::ResourceRequest(request);
+}
+
+Integration::ResourcePointer TestPlatformAbstraction::LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath )
+{
+ mTrace.PushCall("LoadResourceSynchronously", "");
+ return mResources.loadedResource;
+}
+
+/**
+ * @copydoc PlatformAbstraction::SaveResource()
+ */
+void TestPlatformAbstraction::SaveResource(const Integration::ResourceRequest& request)
+{
+ mTrace.PushCall("SaveResource", "");
+ if(mRequest != NULL)
+ {
+ delete mRequest;
+ tet_infoline ("Warning: multiple resource requests not handled by Test Suite. You may see unexpected errors");
+ }
+ mRequest = new Integration::ResourceRequest(request);
+}
+
+/**
+ * @copydoc PlatformAbstraction::CancelLoad()
+ */
+void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
+{
+ mTrace.PushCall("CancelLoad", "");
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetResources()
+ */
+void TestPlatformAbstraction::GetResources(Integration::ResourceCache& cache)
+{
+ mTrace.PushCall("GetResources", "");
+
+ if(mResources.loaded)
+ {
+ cache.LoadResponse( mResources.loadedId, mResources.loadedType, mResources.loadedResource, Integration::RESOURCE_COMPLETELY_LOADED );
+ }
+ if(mResources.loadFailed)
+ {
+ cache.LoadFailed( mResources.loadFailedId, mResources.loadFailure );
+ }
+ if(mResources.saved)
+ {
+ cache.SaveComplete( mResources.savedId, mResources.savedType );
+ }
+ if(mResources.saveFailed)
+ {
+ cache.SaveFailed( mResources.saveFailedId, mResources.saveFailure );
+ }
+}
+
+/**
+ * @copydoc PlatformAbstraction::IsLoading()
+ */
+bool TestPlatformAbstraction::IsLoading()
+{
+ mTrace.PushCall("IsLoading", "");
+ return mIsLoadingResult;
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetDefaultFontFamily()
+ */
+std::string TestPlatformAbstraction::GetDefaultFontFamily() const
+{
+ mTrace.PushCall("GetDefaultFontFamily", "");
+ return mGetDefaultFontFamilyResult;
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetDefaultFontSize()
+ */
+const float TestPlatformAbstraction::GetDefaultFontSize() const
+{
+ mTrace.PushCall("GetDefaultFontSize", "");
+ return mGetDefaultFontSizeResult;
+}
+
+const PixelSize TestPlatformAbstraction::GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, const CapsHeight& capsHeight) const
+{
+ mTrace.PushCall("GetFontLineHeightFromCapsHeight", "");
+ // LineHeight will be bigger than CapsHeight, so return capsHeight + 1
+ return PixelSize(capsHeight + 1);
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetGlyphData()
+ */
+
+Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration::TextResourceType& textRequest,
+ const std::string& fontFamily,
+ bool getBitmap) const
+{
+ if( getBitmap )
+ {
+ mTrace.PushCall("GetGlyphData", "getBitmap:true");
+ }
+ else
+ {
+ mTrace.PushCall("GetGlyphData", "getBitmap:false");
+ }
+
+ // It creates fake metrics for the received characters.
+
+ Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
+ Integration::BitmapPtr bitmapData;
+
+ std::set<uint32_t> characters;
+
+ for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
+ {
+ if( characters.find( it->character ) == characters.end() )
+ {
+ characters.insert( it->character );
+ Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::LOW_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
+
+ if( getBitmap )
+ {
+ bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+ bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
+ PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
+ memset( pixelBuffer, it->character, 64*64 );
+ }
+
+ set->AddCharacter(bitmapData, character);
+ }
+ }
+
+ set->mLineHeight = 10.0f;
+ set->mAscender = 9.0f;
+ set->mUnitsPerEM = 2048.0f/64.0f;
+ set->SetAtlasResourceId( textRequest.mTextureAtlasId );
+ set->mFontHash = textRequest.mFontHash;
+
+ return set;
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetCachedGlyphData()
+ */
+
+Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integration::TextResourceType& textRequest,
+ const std::string& fontFamily ) const
+{
+ mTrace.PushCall("GetCachedGlyphData", "");
+
+ // It creates fake metrics and bitmap for received numeric characters '0' through '9'.
+ Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
+ Integration::BitmapPtr bitmapData;
+
+ std::set<uint32_t> characters;
+
+ for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
+ {
+ if( it->character >= '0' && it->character <= '9' && characters.find( it->character ) == characters.end() )
+ {
+ characters.insert( it->character );
+ Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
+
+ bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+ bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
+ PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
+ memset( pixelBuffer, it->character, 64*64 );
+ set->AddCharacter(bitmapData, character);
+ }
+ }
+
+ set->mLineHeight = 10.0f;
+ set->mAscender = 9.0f;
+ set->mUnitsPerEM = 2048.0f/64.0f;
+ set->SetAtlasResourceId( textRequest.mTextureAtlasId );
+ set->mFontHash = textRequest.mFontHash;
+
+ return set;
+}
+
+
+/**
+ * @copydoc PlatformAbstraction::GetGlobalMetrics()
+ */
+void TestPlatformAbstraction::GetGlobalMetrics( const std::string& fontFamily,
+ const std::string& fontStyle,
+ Integration::GlobalMetrics& globalMetrics ) const
+{
+ globalMetrics.lineHeight = 10.0f;
+ globalMetrics.ascender = 9.0f;
+ globalMetrics.unitsPerEM = 2048.0f/64.0f;
+ globalMetrics.underlineThickness = 2.f;
+ globalMetrics.underlinePosition = 1.f;
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetFontPath()
+ */
+std::string TestPlatformAbstraction::GetFontPath(const std::string& family, bool bold, bool italic) const
+{
+ mTrace.PushCall("GetFontPath", "");
+ return mGetFontPathResult;
+
+ // Do nothing with arguments
+}
+
+/**
+ * @copydoc PlatformAbstraction::SetDpi()
+ */
+void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
+{
+ mTrace.PushCall("SetDpi", "");
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetFontFamilyForChars()
+ */
+std::string TestPlatformAbstraction::GetFontFamilyForChars(const TextArray& charsRequested) const
+{
+ mTrace.PushCall("GetFontFamilyForChars", "");
+ return mGetDefaultFontFamilyResult;
+}
+
+/**
+ * @copydoc PlatformAbstraction::AllGlyphsSupported()
+ */
+bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const
+{
+ mTrace.PushCall("AllGlyphsSupported", "");
+ return true;
+}
+
+/**
+ * @copydoc PlatformAbstraction::ValidateFontFamilyName()
+ */
+bool TestPlatformAbstraction::ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const
+{
+ mTrace.PushCall("ValidateFontFamilyName", "");
+ return true;
+}
+
+/**
+ * @copydoc PlatformAbstraction::GetFontList()
+ */
+std::vector<std::string> TestPlatformAbstraction::GetFontList( PlatformAbstraction::FontListMode mode ) const
+{
+ mFontListMode = mode;
+ mTrace.PushCall("ValidateGetFontList", "");
+ std::vector<std::string> fontList;
+ return fontList;
+}
+
+/**
+ * @copydoc PlatformAbstraction::LoadFile()
+ */
+bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+{
+ mTrace.PushCall("LoadFile", "");
+ if( mLoadFileResult.loadResult )
+ {
+ buffer = mLoadFileResult.buffer;
+ }
+
+ return mLoadFileResult.loadResult;
+}
+
+/**
+ * @copydoc PlatformAbstraction::SaveFile()
+ */
+bool TestPlatformAbstraction::SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const
+{
+ mTrace.PushCall("SaveFile", "");
+ return false;
+}
+
+void TestPlatformAbstraction::JoinLoaderThreads()
+{
+ mTrace.PushCall("JoinLoaderThreads", "");
+}
+
+void TestPlatformAbstraction::UpdateDefaultsFromDevice()
+{
+ mTrace.PushCall("UpdateDefaultsFromDevice", "");
+ mGetDefaultFontFamilyResult+=1.0f;
+}
+
+Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory()
+{
+ mTrace.PushCall("GetDynamicsFactory", "");
+ return NULL;
+}
+
+bool TestPlatformAbstraction::ReadGlobalMetricsFromCache( const std::string& fontFamily,
+ const std::string& fontStyle,
+ Integration::GlobalMetrics& globalMetrics )
+{
+ mTrace.PushCall("ReadGlobalMetricsFromCacheFile", "");
+ globalMetrics = mReadGlobalMetrics; // Want to copy contents...
+ return mReadGlobalMetricsResult; // Default false (will be set to true on subsequent write)
+}
+
+void TestPlatformAbstraction::WriteGlobalMetricsToCache( const std::string& fontFamily,
+ const std::string& fontStyle,
+ const Integration::GlobalMetrics& globalMetrics )
+{
+ // Copy so next read uses written values. TODO: Could add method
+ // to turn this behaviour off for more extensive testing.
+ mReadGlobalMetrics = globalMetrics;
+ mReadGlobalMetricsResult = true;
+
+ mTrace.PushCall("WriteGlobalMetricsToCacheFile", "");
+}
+
+bool TestPlatformAbstraction::ReadMetricsFromCache( const std::string& fontFamily,
+ const std::string& fontStyle,
+ std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
+{
+ mTrace.PushCall("ReadMetricsFromCacheFile", "");
+ glyphMetricsContainer = mReadMetrics;
+ return mReadMetricsResult; // Default false (will be set to true on subsequent write)
+}
+
+void TestPlatformAbstraction::WriteMetricsToCache( const std::string& fontFamily,
+ const std::string& fontStyle,
+ const Integration::GlyphSet& glyphSet )
+{
+ // Copy so next read uses written values. TODO: Could add method
+ // to turn this behaviour off for more extensive testing.
+ const Integration::GlyphSet::CharacterList& charList = glyphSet.GetCharacterList();
+ mReadMetrics.clear();
+ for(std::size_t i=0, end=charList.size(); i<end; ++i)
+ {
+ mReadMetrics.push_back(charList[i].second);
+ }
+ mReadMetricsResult = true;
+
+ mTrace.PushCall("WriteMetricsToCacheFile", "");
+}
+
+
+void TestPlatformAbstraction::GetFileNamesFromDirectory( const std::string& directoryName,
+ std::vector<std::string>& fileNames )
+{
+ fileNames.push_back( std::string( "u1f004.png" ) );
+ fileNames.push_back( std::string( "u1f0cf.png" ) );
+ fileNames.push_back( std::string( "u1f170.png" ) );
+ fileNames.push_back( std::string( "u1f601.png" ) );
+}
+
+
+Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
+{
+ Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+ image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
+
+ mTrace.PushCall("GetGlyphImage", "");
+
+ return image;
+}
+
+
+/** Call this every test */
+void TestPlatformAbstraction::Initialize()
+{
+ mTrace.Reset();
+ mTrace.Enable(true);
+ memset(&mResources, 0, sizeof(Resources));
+ memset(&mReadGlobalMetrics, 0, sizeof(Integration::GlobalMetrics));
+ mSeconds=0;
+ mMicroSeconds=0;
+ mIsLoadingResult=false;
+ mGetDefaultFontFamilyResult = "HelveticaNeue";
+ mGetDefaultFontSizeResult=12.0f;
+ mGetFontPathResult="helvetica-12";
+ mReadMetricsResult=false;
+ mReadGlobalMetricsResult=false;
+
+ if(mRequest)
+ {
+ delete mRequest;
+ mRequest = 0;
+ }
+}
+
+
+bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
+{
+ switch(func)
+ {
+ case GetTimeMicrosecondsFunc: return mTrace.FindMethod("GetTimeMicroseconds");
+ case SuspendFunc: return mTrace.FindMethod("Suspend");
+ case ResumeFunc: return mTrace.FindMethod("Resume");
+ case LoadResourceFunc: return mTrace.FindMethod("LoadResource");
+ case SaveResourceFunc: return mTrace.FindMethod("SaveResource");
+ case LoadFileFunc: return mTrace.FindMethod("LoadFile");
+ case SaveFileFunc: return mTrace.FindMethod("SaveFile");
+ case CancelLoadFunc: return mTrace.FindMethod("CancelLoad");
+ case GetResourcesFunc: return mTrace.FindMethod("GetResources");
+ case IsLoadingFunc: return mTrace.FindMethod("IsLoading");
+ case GetDefaultFontFamilyFunc: return mTrace.FindMethod("GetDefaultFontFamily");
+ case GetDefaultFontSizeFunc: return mTrace.FindMethod("GetDefaultFontSize");
+ case GetFontLineHeightFromCapsHeightFunc: return mTrace.FindMethod("GetFontLineHeightFromCapsHeight");
+ case GetGlyphDataFunc: return mTrace.FindMethod("GetGlyphData");
+ case GetCachedGlyphDataFunc: return mTrace.FindMethod("GetCachedGlyphData");
+ case GetFontPathFunc: return mTrace.FindMethod("GetFontPath");
+ case SetDpiFunc: return mTrace.FindMethod("SetDpi");
+ case JoinLoaderThreadsFunc: return mTrace.FindMethod("JoinLoaderThreads");
+ case GetFontFamilyForCharsFunc: return mTrace.FindMethod("GetFontFamilyForChars");
+ case AllGlyphsSupportedFunc: return mTrace.FindMethod("AllGlyphsSupported");
+ case ValidateFontFamilyNameFunc: return mTrace.FindMethod("ValidateFontFamilyName");
+ case UpdateDefaultsFromDeviceFunc: return mTrace.FindMethod("UpdateDefaultsFromDevice");
+ case GetDynamicsFactoryFunc: return mTrace.FindMethod("GetDynamicsFactory");
+ case ValidateGetFontListFunc: return mTrace.FindMethod("ValidateGetFontList");
+ case ReadGlobalMetricsFromCacheFileFunc: return mTrace.FindMethod("ReadGlobalMetricsFromCacheFile");
+ case WriteGlobalMetricsToCacheFileFunc: return mTrace.FindMethod("WriteGlobalMetricsToCacheFile");
+ case ReadMetricsFromCacheFileFunc: return mTrace.FindMethod("ReadMetricsFromCacheFile");
+ case WriteMetricsToCacheFileFunc: return mTrace.FindMethod("WriteMetricsToCacheFile");
+ }
+ return false;
+}
+
+void TestPlatformAbstraction::SetGetTimeMicrosecondsResult(size_t sec, size_t usec)
+{
+ mSeconds = sec;
+ mMicroSeconds = usec;
+}
+
+void TestPlatformAbstraction::IncrementGetTimeResult(size_t milliseconds)
+{
+ mMicroSeconds += milliseconds * 1000u;
+ unsigned int additionalSeconds = mMicroSeconds / 1000000u;
+
+ mSeconds += additionalSeconds;
+ mMicroSeconds -= additionalSeconds * 1000000u;
+}
+
+void TestPlatformAbstraction::SetIsLoadingResult(bool result)
+{
+ mIsLoadingResult = result;
+}
+
+void TestPlatformAbstraction::SetGetDefaultFontFamilyResult(std::string result)
+{
+ mGetDefaultFontFamilyResult = result;
+}
+
+void TestPlatformAbstraction::SetGetDefaultFontSizeResult(float result)
+{
+ mGetDefaultFontSizeResult = result;
+}
+
+void TestPlatformAbstraction::SetGetFontPathResult(std::string& result)
+{
+ mGetFontPathResult = result;
+}
+
+void TestPlatformAbstraction::ClearReadyResources()
+{
+ memset(&mResources, 0, sizeof(Resources));
+}
+
+void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId loadedId,
+ Integration::ResourceTypeId loadedType,
+ Integration::ResourcePointer loadedResource)
+{
+ mResources.loaded = true;
+ mResources.loadedId = loadedId;
+ mResources.loadedType = loadedType;
+ mResources.loadedResource = loadedResource;
+}
+
+void TestPlatformAbstraction::SetResourceLoadFailed(Integration::ResourceId id,
+ Integration::ResourceFailure failure)
+{
+ mResources.loadFailed = true;
+ mResources.loadFailedId = id;
+ mResources.loadFailure = failure;
+}
+
+void TestPlatformAbstraction::SetResourceSaved(Integration::ResourceId savedId,
+ Integration::ResourceTypeId savedType)
+{
+ mResources.saved = true;
+ mResources.savedId = savedId;
+ mResources.savedType = savedType;
+}
+
+void TestPlatformAbstraction::SetResourceSaveFailed(Integration::ResourceId id,
+ Integration::ResourceFailure failure)
+{
+ mResources.saveFailed = true;
+ mResources.saveFailedId = id;
+ mResources.saveFailure = failure;
+}
+
+Integration::ResourceRequest* TestPlatformAbstraction::GetRequest()
+{
+ return mRequest;
+}
+
+void TestPlatformAbstraction::DiscardRequest()
+{
+ delete mRequest;
+ mRequest = NULL;
+}
+
+void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
+{
+ mClosestSize = size;
+}
+
+void TestPlatformAbstraction::SetLoadFileResult( bool result, std::vector< unsigned char >& buffer )
+{
+ mLoadFileResult.loadResult = result;
+ if( result )
+ {
+ mLoadFileResult.buffer = buffer;
+ }
+}
+
+void TestPlatformAbstraction::SetSaveFileResult( bool result )
+{
+ mSaveFileResult = result;
+}
+
+Integration::PlatformAbstraction::FontListMode TestPlatformAbstraction::GetLastFontListMode( )
+{
+ return mFontListMode;
+}
+
+void TestPlatformAbstraction::SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics )
+{
+ mReadGlobalMetricsResult = success;
+ mReadGlobalMetrics = globalMetrics;
+}
+
+void TestPlatformAbstraction::SetReadMetricsResult( bool success, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
+{
+ mReadMetricsResult = success;
+ mReadMetrics = glyphMetricsContainer; // copy
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TEST_PLATFORM_ABSTRACTION_H__
+#define __DALI_TEST_PLATFORM_ABSTRACTION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <set>
+#include <stdint.h>
+#include <cstring>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/platform-abstraction.h>
+
+#include <dali/integration-api/glyph-set.h>
+#include "test-trace-call-stack.h"
+
+
+namespace Dali
+{
+
+/**
+ * Concrete implementation of the platform abstraction class.
+ */
+class DALI_IMPORT_API TestPlatformAbstraction : public Dali::Integration::PlatformAbstraction
+{
+
+public:
+
+ struct Resources
+ {
+ bool loaded;
+ Integration::ResourceId loadedId;
+ Integration::ResourceTypeId loadedType;
+ Integration::ResourcePointer loadedResource;
+
+ bool loadFailed;
+ Integration::ResourceId loadFailedId;
+ Integration::ResourceFailure loadFailure;
+
+ bool saved;
+ Integration::ResourceId savedId;
+ Integration::ResourceTypeId savedType;
+
+ bool saveFailed;
+ Integration::ResourceId saveFailedId;
+ Integration::ResourceFailure saveFailure;
+ };
+
+ struct LoadFileResult
+ {
+ inline LoadFileResult()
+ : loadResult(false)
+ {
+
+ }
+
+ bool loadResult;
+ std::vector< unsigned char> buffer;
+ };
+
+ /**
+ * Constructor
+ */
+ TestPlatformAbstraction();
+
+ /**
+ * Destructor
+ */
+ virtual ~TestPlatformAbstraction();
+
+ /**
+ * @copydoc PlatformAbstraction::GetTimeMicroseconds()
+ */
+ virtual void GetTimeMicroseconds(unsigned int &seconds, unsigned int µSeconds);
+
+ /**
+ * @copydoc PlatformAbstraction::Suspend()
+ */
+ virtual void Suspend();
+
+ /**
+ * @copydoc PlatformAbstraction::Resume()
+ */
+ virtual void Resume();
+
+ virtual void GetClosestImageSize( const std::string& filename,
+ const ImageAttributes& attributes,
+ Vector2& closestSize);
+
+ virtual void GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
+ const ImageAttributes& attributes,
+ Vector2& closestSize);
+
+ /**
+ * @copydoc PlatformAbstraction::LoadResource()
+ */
+ virtual void LoadResource(const Integration::ResourceRequest& request);
+
+ /**
+ * @copydoc PlatformAbstraction::LoadResourceSynchronously()
+ */
+ virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
+
+ /**
+ * @copydoc PlatformAbstraction::SaveResource()
+ */
+ virtual void SaveResource(const Integration::ResourceRequest& request);
+
+ /**
+ * @copydoc PlatformAbstraction::CancelLoad()
+ */
+ virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
+
+ /**
+ * @copydoc PlatformAbstraction::GetResources()
+ */
+ virtual void GetResources(Integration::ResourceCache& cache);
+
+ /**
+ * @copydoc PlatformAbstraction::IsLoading()
+ */
+ virtual bool IsLoading();
+
+ /**
+ * @copydoc PlatformAbstraction::GetDefaultFontFamily()
+ */
+ virtual std::string GetDefaultFontFamily() const;
+
+ /**
+ * @copydoc PlatformAbstraction::GetDefaultFontSize()
+ */
+ virtual const float GetDefaultFontSize() const;
+
+ virtual const Dali::PixelSize GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, const CapsHeight& capsHeight) const;
+
+ /**
+ * @copydoc PlatformAbstraction::GetGlyphData()
+ */
+ virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
+ const std::string& fontFamily,
+ bool getBitmap) const;
+
+ /**
+ * @copydoc PlatformAbstraction::GetCachedGlyphData()
+ */
+ virtual Integration::GlyphSet* GetCachedGlyphData( const Integration::TextResourceType& textRequest,
+ const std::string& fontFamily ) const;
+
+
+ /**
+ * @copydoc PlatformAbstraction::GetGlobalMetrics()
+ */
+ virtual void GetGlobalMetrics( const std::string& fontFamily,
+ const std::string& fontStyle,
+ Integration::GlobalMetrics& globalMetrics ) const;
+
+ /**
+ * @copydoc PlatformAbstraction::GetFontPath()
+ */
+ virtual std::string GetFontPath(const std::string& family, bool bold, bool italic) const;
+
+ /**
+ * @copydoc PlatformAbstraction::SetDpi()
+ */
+ virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
+
+ /**
+ * @copydoc PlatformAbstraction::GetFontFamilyForChars()
+ */
+ virtual std::string GetFontFamilyForChars(const TextArray& charsRequested) const;
+
+ /**
+ * @copydoc PlatformAbstraction::AllGlyphsSupported()
+ */
+ virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const;
+
+ /**
+ * @copydoc PlatformAbstraction::ValidateFontFamilyName()
+ */
+ virtual bool ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const;
+
+ /**
+ * @copydoc PlatformAbstraction::GetFontList()
+ */
+ virtual std::vector<std::string> GetFontList( PlatformAbstraction::FontListMode mode ) const;
+
+ /**
+ * @copydoc PlatformAbstraction::LoadFile()
+ */
+ virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
+
+ /**
+ * @copydoc PlatformAbstraction::SaveFile()
+ */
+ virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const;
+
+ virtual void JoinLoaderThreads();
+
+ virtual void UpdateDefaultsFromDevice();
+
+ virtual Integration::DynamicsFactory* GetDynamicsFactory();
+
+ virtual bool ReadGlobalMetricsFromCache( const std::string& fontFamily,
+ const std::string& fontStyle,
+ Integration::GlobalMetrics& globalMetrics );
+
+ virtual void WriteGlobalMetricsToCache( const std::string& fontFamily,
+ const std::string& fontStyle,
+ const Integration::GlobalMetrics& globalMetrics );
+
+ virtual bool ReadMetricsFromCache( const std::string& fontFamily,
+ const std::string& fontStyle,
+ std::vector<Integration::GlyphMetrics>& glyphMetricsContainer );
+ virtual void WriteMetricsToCache( const std::string& fontFamily,
+ const std::string& fontStyle,
+ const Integration::GlyphSet& glyphSet );
+
+
+ virtual void GetFileNamesFromDirectory( const std::string& directoryName,
+ std::vector<std::string>& fileNames );
+
+ virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
+
+public: // TEST FUNCTIONS
+
+ // Enumeration of Platform Abstraction methods
+ typedef enum
+ {
+ GetTimeMicrosecondsFunc,
+ SuspendFunc,
+ ResumeFunc,
+ LoadResourceFunc,
+ SaveResourceFunc,
+ SaveFileFunc,
+ LoadFileFunc,
+ CancelLoadFunc,
+ GetResourcesFunc,
+ IsLoadingFunc,
+ GetDefaultFontFamilyFunc,
+ GetDefaultFontSizeFunc,
+ GetFontLineHeightFromCapsHeightFunc,
+ GetGlyphDataFunc,
+ GetCachedGlyphDataFunc,
+ SetDpiFunc,
+ GetFontPathFunc,
+ JoinLoaderThreadsFunc,
+ GetFontFamilyForCharsFunc,
+ AllGlyphsSupportedFunc,
+ ValidateFontFamilyNameFunc,
+ UpdateDefaultsFromDeviceFunc,
+ GetDynamicsFactoryFunc,
+ ValidateGetFontListFunc,
+ ReadGlobalMetricsFromCacheFileFunc,
+ WriteGlobalMetricsToCacheFileFunc,
+ ReadMetricsFromCacheFileFunc,
+ WriteMetricsToCacheFileFunc,
+ } TestFuncEnum;
+
+ /** Call this every test */
+ void Initialize();
+
+ inline void EnableTrace(bool enable) { mTrace.Enable(enable); }
+ inline void ResetTrace() { mTrace.Reset(); }
+ inline TraceCallStack& GetTrace() { return mTrace; }
+
+ bool WasCalled(TestFuncEnum func);
+
+ void SetGetTimeMicrosecondsResult(size_t sec, size_t usec);
+
+ void IncrementGetTimeResult(size_t milliseconds);
+
+ void SetIsLoadingResult(bool result);
+
+ void SetGetDefaultFontFamilyResult(std::string result);
+
+ void SetGetDefaultFontSizeResult(float result);
+
+ void SetGetFontPathResult(std::string& result);
+
+ void ClearReadyResources();
+
+ void SetResourceLoaded(Integration::ResourceId loadedId,
+ Integration::ResourceTypeId loadedType,
+ Integration::ResourcePointer loadedResource);
+
+ void SetResourceLoadFailed(Integration::ResourceId id,
+ Integration::ResourceFailure failure);
+
+ void SetResourceSaved(Integration::ResourceId savedId,
+ Integration::ResourceTypeId savedType);
+
+ void SetResourceSaveFailed(Integration::ResourceId id,
+ Integration::ResourceFailure failure);
+
+ Integration::ResourceRequest* GetRequest();
+
+ void DiscardRequest();
+
+ void SetClosestImageSize(const Vector2& size);
+
+ void SetLoadFileResult( bool result, std::vector< unsigned char >& buffer );
+
+ void SetSaveFileResult( bool result );
+
+ PlatformAbstraction::FontListMode GetLastFontListMode( );
+
+ void SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics );
+
+ void SetReadMetricsResult( bool success, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer );
+
+
+private:
+ mutable TraceCallStack mTrace;
+ size_t mSeconds;
+ size_t mMicroSeconds;
+ bool mIsLoadingResult;
+ std::string mGetDefaultFontFamilyResult;
+ float mGetDefaultFontSizeResult;
+ std::string mGetFontPathResult;
+ Resources mResources;
+ Integration::ResourceRequest* mRequest;
+ Vector2 mSize;
+ Vector2 mClosestSize;
+ bool mReadGlobalMetricsResult;
+ bool mReadMetricsResult;
+ Integration::GlobalMetrics mReadGlobalMetrics;
+ std::vector<Integration::GlyphMetrics> mReadMetrics;
+
+ LoadFileResult mLoadFileResult;
+ bool mSaveFileResult;
+ mutable FontListMode mFontListMode;
+};
+
+} // Dali
+
+#endif /* __DALI_TET_PLATFORM_ABSTRACTION_H__ */
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "test-render-controller.h"
+
+namespace Dali
+{
+
+TestRenderController::TestRenderController()
+{
+ Initialize();
+}
+
+TestRenderController::~TestRenderController()
+{
+}
+
+void TestRenderController::RequestUpdate()
+{
+ mRequestUpdateCalled = true;
+}
+
+void TestRenderController::RequestProcessEventsOnIdle()
+{
+ mRequestProcessEventsOnIdleCalled = true;
+}
+
+bool TestRenderController::WasCalled(TestRenderControllerFuncEnum func)
+{
+ switch(func)
+ {
+ case RequestUpdateFunc: return mRequestUpdateCalled;
+ case RequestProcessEventsOnIdleFunc: return mRequestProcessEventsOnIdleCalled;
+ }
+
+ return false;
+}
+
+void TestRenderController::Initialize()
+{
+ mRequestUpdateCalled = false;
+ mRequestProcessEventsOnIdleCalled = false;
+}
+
+
+} // namespace dali
--- /dev/null
+#ifndef __TEST_RENDER_CONTROLLER_H__
+#define __TEST_RENDER_CONTROLLER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/integration-api/render-controller.h>
+
+namespace Dali
+{
+
+class DALI_IMPORT_API TestRenderController : public Dali::Integration::RenderController
+{
+public:
+ TestRenderController();
+ ~TestRenderController();
+
+ virtual void RequestUpdate();
+ virtual void RequestProcessEventsOnIdle();
+
+ typedef enum
+ {
+ RequestUpdateFunc,
+ RequestProcessEventsOnIdleFunc,
+ } TestRenderControllerFuncEnum;
+
+ bool WasCalled(TestRenderControllerFuncEnum func);
+ void Initialize();
+
+
+private:
+ bool mRequestUpdateCalled;
+ bool mRequestProcessEventsOnIdleCalled;
+};
+
+} // Dali
+
+#endif
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "test-trace-call-stack.h"
+
+namespace Dali
+{
+/**
+ * Constructor
+ */
+TraceCallStack::TraceCallStack() : mTraceActive(false) { }
+
+/**
+ * Destructor
+ */
+TraceCallStack::~TraceCallStack() { }
+
+/**
+ * Turn on / off tracing
+ */
+void TraceCallStack::Enable(bool enable) { mTraceActive = enable; }
+
+/**
+ * Push a call onto the stack if the trace is active
+ * @param[in] method The name of the method
+ * @param[in] params A comma separated list of parameter values
+ */
+void TraceCallStack::PushCall(std::string method, std::string params)
+{
+ if(mTraceActive)
+ {
+ std::vector< std::string > functionCall;
+ functionCall.push_back(method);
+ functionCall.push_back(params);
+ mCallStack.push_back( functionCall );
+ }
+}
+
+/**
+ * Search for a method in the stack
+ * @param[in] method The name of the method
+ * @return true if the method was in the stack
+ */
+bool TraceCallStack::FindMethod(std::string method) const
+{
+ bool found = false;
+ for( size_t i=0; i < mCallStack.size(); i++ )
+ {
+ if( 0 == mCallStack[i][0].compare(method) )
+ {
+ found = true;
+ break;
+ }
+ }
+ return found;
+}
+
+/**
+ * Search for a method in the stack with the given parameter list
+ * @param[in] method The name of the method
+ * @param[in] params A comma separated list of parameter values
+ * @return true if the method was in the stack
+ */
+bool TraceCallStack::FindMethodAndParams(std::string method, std::string params) const
+{
+ bool found = false;
+ for( size_t i=0; i < mCallStack.size(); i++ )
+ {
+ if( 0 == mCallStack[i][0].compare(method) && 0 == mCallStack[i][1].compare(params) )
+ {
+ found = true;
+ break;
+ }
+ }
+ return found;
+}
+
+/**
+ * Test if the given method and parameters are at a given index in the stack
+ * @param[in] index Index in the call stack
+ * @param[in] method Name of method to test
+ * @param[in] params A comma separated list of parameter values to test
+ */
+bool TraceCallStack::TestMethodAndParams(int index, std::string method, std::string params) const
+{
+ return ( 0 == mCallStack[index][0].compare(method) && 0 == mCallStack[index][1].compare(params) );
+}
+
+/**
+ * Reset the call stack
+ */
+void TraceCallStack::Reset()
+{
+ mCallStack.clear();
+}
+
+
+} // namespace Dali
--- /dev/null
+#ifndef __TEST_TRACE_CALL_STACK_H__
+#define __TEST_TRACE_CALL_STACK_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <string>
+#include <vector>
+
+namespace Dali
+{
+
+/**
+ * Helper class to track method calls in the abstraction and search for them in test cases
+ */
+class TraceCallStack
+{
+public:
+ /**
+ * Constructor
+ */
+ TraceCallStack();
+
+ /**
+ * Destructor
+ */
+ ~TraceCallStack();
+
+ /**
+ * Turn on / off tracing
+ */
+ void Enable(bool enable);
+
+ /**
+ * Push a call onto the stack if the trace is active
+ * @param[in] method The name of the method
+ * @param[in] params A comma separated list of parameter values
+ */
+ void PushCall(std::string method, std::string params);
+
+
+ /**
+ * Search for a method in the stack
+ * @param[in] method The name of the method
+ * @return true if the method was in the stack
+ */
+ bool FindMethod(std::string method) const;
+
+ /**
+ * Search for a method in the stack with the given parameter list
+ * @param[in] method The name of the method
+ * @param[in] params A comma separated list of parameter values
+ * @return true if the method was in the stack
+ */
+ bool FindMethodAndParams(std::string method, std::string params) const;
+
+ /**
+ * Test if the given method and parameters are at a given index in the stack
+ * @param[in] index Index in the call stack
+ * @param[in] method Name of method to test
+ * @param[in] params A comma separated list of parameter values to test
+ */
+ bool TestMethodAndParams(int index, std::string method, std::string params) const;
+
+ /**
+ * Reset the call stack
+ */
+ void Reset();
+
+ /**
+ * Get the call stack
+ * @return The call stack object (Vector of vector[2] of method/paramlist strings)
+ */
+ inline const std::vector< std::vector< std::string > >& GetCallStack() { return mCallStack; }
+
+private:
+ bool mTraceActive; ///< True if the trace is active
+ std::vector< std::vector< std::string > > mCallStack; ///< The call stack
+};
+
+} // namespace dali
+
+#endif //__TEST_TRACE_CALL_STACK_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-accessibility-manager.h"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Stub for the AccessibilityManager
+ */
+class AccessibilityManager : public BaseObject
+{
+public: // Creation & Destruction
+
+ static Dali::AccessibilityManager Get();
+
+ AccessibilityManager();
+ ~AccessibilityManager();
+
+public:
+
+ bool IsEnabled() const;
+ void SetActionHandler(Dali::AccessibilityActionHandler& handler);
+ void SetGestureHandler(Dali::AccessibilityGestureHandler& handler);
+
+public: // Signals
+
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& StatusChangedSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionNextSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionPreviousSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionActivateSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionReadSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionReadNextSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionReadPreviousSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionOverSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionUpSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionDownSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionClearFocusSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionBackSignal();
+ Dali::AccessibilityManager::AccessibilityActionSignalV2& ActionControlPanelOpenSignal();
+
+private:
+
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mStatusChangedSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionNextSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionPreviousSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionActivateSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionReadSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionReadNextSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionReadPreviousSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionOverSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionUpSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionDownSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionClearFocusSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionBackSignal;
+ Dali::AccessibilityManager::AccessibilityActionSignalV2 mActionControlPanelOpenSignal;
+
+ bool mIsEnabled;
+ Dali::AccessibilityActionHandler* mActionHandler;
+ Dali::AccessibilityGestureHandler* mGestureHandler;
+
+ static Dali::AccessibilityManager mToolkitAccessibilityManager;
+};
+
+Dali::AccessibilityManager AccessibilityManager::mToolkitAccessibilityManager;
+
+
+Dali::AccessibilityManager AccessibilityManager::Get()
+{
+ if( ! mToolkitAccessibilityManager )
+ {
+ mToolkitAccessibilityManager = Dali::AccessibilityManager( new Dali::Internal::Adaptor::AccessibilityManager() );
+ }
+ return mToolkitAccessibilityManager;
+}
+
+AccessibilityManager::AccessibilityManager()
+: mIsEnabled(false)
+{
+}
+
+AccessibilityManager::~AccessibilityManager()
+{
+}
+
+bool AccessibilityManager::IsEnabled() const
+{
+ return mIsEnabled;
+}
+
+void AccessibilityManager::SetActionHandler(Dali::AccessibilityActionHandler& handler)
+{
+ mActionHandler = &handler;
+}
+
+void AccessibilityManager::SetGestureHandler(Dali::AccessibilityGestureHandler& handler)
+{
+ mGestureHandler = &handler;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::StatusChangedSignal()
+{
+ return mStatusChangedSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionNextSignal()
+{
+ return mActionNextSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionPreviousSignal()
+{
+ return mActionPreviousSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionActivateSignal()
+{
+ return mActionActivateSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadSignal()
+{
+ return mActionReadSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadNextSignal()
+{
+ return mActionReadNextSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadPreviousSignal()
+{
+ return mActionReadPreviousSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionOverSignal()
+{
+ return mActionOverSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionUpSignal()
+{
+ return mActionUpSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionDownSignal()
+{
+ return mActionDownSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionClearFocusSignal()
+{
+ return mActionClearFocusSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionBackSignal()
+{
+ return mActionBackSignal;
+}
+
+Dali::AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionControlPanelOpenSignal()
+{
+ return mActionControlPanelOpenSignal;
+}
+
+static Internal::Adaptor::AccessibilityManager& GetImplementation(Dali::AccessibilityManager& manager)
+{
+ BaseObject& handle = manager.GetBaseObject();
+ return static_cast<Internal::Adaptor::AccessibilityManager&>(handle);
+}
+
+
+} // namespace Adaptor
+} // namespace Internal
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+AccessibilityManager::AccessibilityManager()
+{
+}
+
+AccessibilityManager AccessibilityManager::Get()
+{
+ return Internal::Adaptor::AccessibilityManager::Get();
+}
+
+AccessibilityManager::~AccessibilityManager()
+{
+}
+
+Vector2 AccessibilityManager::GetReadPosition() const
+{
+ //return Internal::Adaptor::GetImplementation(*this).GetReadPosition();
+ return Vector2::ZERO;
+}
+
+bool AccessibilityManager::IsEnabled() const
+{
+ //return Internal::Adaptor::GetImplementation(*this).IsEnabled();
+ return false;
+}
+
+void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler)
+{
+ Internal::Adaptor::GetImplementation(*this).SetActionHandler(handler);
+}
+
+void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler)
+{
+ Internal::Adaptor::GetImplementation(*this).SetGestureHandler(handler);
+}
+
+bool AccessibilityManager::HandleActionNextEvent()
+{
+ return true; //Internal::Adaptor::GetImplementation(*this).HandleActionNextEvent();
+}
+
+bool AccessibilityManager::HandleActionPreviousEvent()
+{
+ return true; //Internal::Adaptor::GetImplementation(*this).HandleActionPreviousEvent();
+}
+
+bool AccessibilityManager::HandleActionActivateEvent()
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionActivateEvent();
+}
+
+bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain)
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain);
+}
+
+bool AccessibilityManager::HandleActionReadNextEvent()
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadNextEvent();
+}
+
+bool AccessibilityManager::HandleActionReadPreviousEvent()
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadPreviousEvent();
+}
+
+bool AccessibilityManager::HandleActionUpEvent()
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionUpEvent();
+}
+
+bool AccessibilityManager::HandleActionDownEvent()
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionDownEvent();
+}
+
+bool AccessibilityManager::HandleActionClearFocusEvent()
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionClearFocusEvent();
+}
+
+bool AccessibilityManager::HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp)
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp);
+}
+
+bool AccessibilityManager::HandleActionBackEvent()
+{
+ return true;//Internal::Adaptor::GetImplementation(*this).HandleActionBackEvent();
+}
+
+void AccessibilityManager::HandleActionEnableEvent()
+{
+ //Internal::Adaptor::GetImplementation(*this).HandleActionEnableEvent();
+}
+
+void AccessibilityManager::HandleActionDisableEvent()
+{
+ //Internal::Adaptor::GetImplementation(*this).HandleActionDisableEvent();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::StatusChangedSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).StatusChangedSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionNextSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionNextSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionPreviousSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionPreviousSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionActivateSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionActivateSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionOverSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionOverSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionReadSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadNextSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionReadNextSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionReadPreviousSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionReadPreviousSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionUpSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionUpSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionDownSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionDownSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionClearFocusSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionClearFocusSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalV2& AccessibilityManager::ActionBackSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ActionBackSignal();
+}
+
+AccessibilityManager::AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager )
+: BaseHandle( manager )
+{
+}
+
+} // namespace Dali
--- /dev/null
+// Prevent normal accessibility manager declaration from loading
+#define __DALI_ACCESSIBILITY_MANAGER_H__
+
+#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
+#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+#include <dali/dali.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class AccessibilityManager;
+}
+}
+class AccessibilityActionHandler;
+class AccessibilityGestureHandler;
+class TouchPoint;
+
+/**
+ * This creates a stubbed AccessibilityManager so that internal Toolkit Adaptor calls work.
+ */
+class AccessibilityManager : public BaseHandle
+{
+public: // Typedefs
+ typedef SignalV2< bool ( AccessibilityManager& ) > AccessibilityActionSignalV2;
+
+public: // Construction & Destruction
+ AccessibilityManager();
+ virtual ~AccessibilityManager();
+
+public: // Getters
+ static AccessibilityManager Get();
+ Vector2 GetReadPosition() const;
+ bool IsEnabled() const;
+ void SetActionHandler(AccessibilityActionHandler& handler);
+ void SetGestureHandler(AccessibilityGestureHandler& handler);
+ bool HandleActionNextEvent();
+ bool HandleActionPreviousEvent();
+ bool HandleActionActivateEvent();
+ bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain);
+ bool HandleActionReadNextEvent();
+ bool HandleActionReadPreviousEvent();
+ bool HandleActionUpEvent();
+ bool HandleActionDownEvent();
+ bool HandleActionClearFocusEvent();
+ bool HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp);
+ bool HandleActionBackEvent();
+ void HandleActionEnableEvent();
+ void HandleActionDisableEvent();
+
+public: // Signals
+ AccessibilityActionSignalV2& StatusChangedSignal();
+ AccessibilityActionSignalV2& ActionNextSignal();
+ AccessibilityActionSignalV2& ActionPreviousSignal();
+ AccessibilityActionSignalV2& ActionActivateSignal();
+ AccessibilityActionSignalV2& ActionReadSignal();
+ AccessibilityActionSignalV2& ActionOverSignal();
+ AccessibilityActionSignalV2& ActionReadNextSignal();
+ AccessibilityActionSignalV2& ActionReadPreviousSignal();
+ AccessibilityActionSignalV2& ActionUpSignal();
+ AccessibilityActionSignalV2& ActionDownSignal();
+ AccessibilityActionSignalV2& ActionClearFocusSignal();
+ AccessibilityActionSignalV2& ActionBackSignal();
+
+ AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager );
+};
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#define __DALI_ADAPTOR_H__
+#define __DALI_ACCESSIBILITY_MANAGER_H__
+#define __DALI_TIMER_H__
+#define __DALI_CLIPBOARD_H__
+#define IMFMANAGER_H
+
+#include "toolkit-adaptor.h"
+#include <map>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+namespace Dali
+{
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class TestRenderSurface : public RenderSurface
+{
+public:
+ TestRenderSurface(){}
+ virtual ~TestRenderSurface(){}
+ virtual SurfaceType GetType() { return RenderSurface::WINDOW; }
+ virtual Dali::Any GetSurface() { return Dali::Any(); }
+ virtual Dali::Any GetDisplay() { return Dali::Any(); }
+ virtual PositionSize GetPositionSize() const { return PositionSize(0, 0, 640, 480);}
+ virtual void SetRenderMode(RenderMode mode){}
+ virtual RenderMode GetRenderMode() const { return RenderSurface::RENDER_60FPS; }
+};
+
+typedef Dali::Rect<int> PositionSize;
+
+/**
+ * Stub for the Adaptor
+ */
+class Adaptor
+{
+public:
+
+ typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2;
+
+ typedef std::pair<std::string, Dali::BaseHandle> SingletonPair;
+ typedef std::map<std::string, Dali::BaseHandle> SingletonContainer;
+ typedef SingletonContainer::const_iterator SingletonConstIter;
+
+public:
+
+ Adaptor(ToolkitAdaptor& toolkitAdaptor);
+ ~Adaptor();
+
+public:
+
+ void Start();
+ void Pause();
+ void Resume();
+ void Stop();
+ bool AddIdle(boost::function<void(void)> callBack);
+ void FeedEvent(TouchPoint& point, int timeStamp);
+ bool MoveResize(const PositionSize& positionSize);
+ void SurfaceResized(const PositionSize& positionSize);
+ void ReplaceSurface(RenderSurface& surface);
+ void RenderSync();
+ RenderSurface& GetSurface();
+
+ void RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton);
+ Dali::BaseHandle GetSingleton(const std::type_info& info) const;
+
+public: // static methods
+ static Adaptor& Get();
+ static bool IsAvailable();
+
+public: // Signals
+
+ AdaptorSignalV2& SignalResize();
+
+ void EmitSignalResize()
+ {
+ mResizeSignal.Emit( *this );
+ }
+
+private:
+
+ // Undefined
+ Adaptor(const Adaptor&);
+ Adaptor& operator=(Adaptor&);
+
+ AdaptorSignalV2 mResizeSignal;
+ TestRenderSurface mRenderSurface;
+ ToolkitAdaptor& mToolkitAdaptor;
+
+ SingletonContainer mSingletonContainer;
+};
+
+namespace
+{
+Adaptor* gAdaptor = NULL;
+
+}
+
+Adaptor::Adaptor(ToolkitAdaptor& toolkitAdaptor)
+: mToolkitAdaptor(toolkitAdaptor)
+{
+}
+
+Adaptor::~Adaptor()
+{
+
+}
+
+void Adaptor::Start()
+{
+ mToolkitAdaptor.mFunctionsCalled.Start = true;
+}
+
+void Adaptor::Pause()
+{
+ mToolkitAdaptor.mFunctionsCalled.Pause = true;
+}
+
+void Adaptor::Resume()
+{
+ mToolkitAdaptor.mFunctionsCalled.Resume = true;
+}
+
+void Adaptor::Stop()
+{
+ mToolkitAdaptor.mFunctionsCalled.Stop = true;
+}
+
+bool Adaptor::AddIdle(boost::function<void(void)> callBack)
+{
+ mToolkitAdaptor.mFunctionsCalled.AddIdle = true;
+ mToolkitAdaptor.mLastIdleAdded = callBack;
+ return true;
+}
+
+void Adaptor::FeedEvent(TouchPoint& point, int timeStamp)
+{
+ mToolkitAdaptor.mFunctionsCalled.FeedEvent = true;
+ mToolkitAdaptor.mLastTouchPointFed = point;
+ mToolkitAdaptor.mLastTimeStampFed = timeStamp;
+}
+
+bool Adaptor::MoveResize(const PositionSize& positionSize)
+{
+ mToolkitAdaptor.mFunctionsCalled.MoveResize = true;
+ mToolkitAdaptor.mLastSizeSet = positionSize;
+ return true;
+}
+
+void Adaptor::SurfaceResized(const PositionSize& positionSize)
+{
+ mToolkitAdaptor.mFunctionsCalled.SurfaceResized = true;
+ mToolkitAdaptor.mLastSizeSet = positionSize;
+}
+
+void Adaptor::ReplaceSurface(RenderSurface& surface)
+{
+ mToolkitAdaptor.mFunctionsCalled.ReplaceSurface = true;
+}
+
+void Adaptor::RenderSync()
+{
+ mToolkitAdaptor.mFunctionsCalled.RenderSync = true;
+}
+
+RenderSurface& Adaptor::GetSurface()
+{
+ mToolkitAdaptor.mFunctionsCalled.GetSurface = true;
+ return mRenderSurface;
+}
+
+Adaptor& Adaptor::Get()
+{
+ DALI_ASSERT_ALWAYS(gAdaptor);
+ gAdaptor->mToolkitAdaptor.mFunctionsCalled.Get = true;
+ return *gAdaptor;
+}
+
+bool Adaptor::IsAvailable()
+{
+ bool available(false);
+
+ if (gAdaptor)
+ {
+ gAdaptor->mToolkitAdaptor.mFunctionsCalled.IsAvailable = true;
+ available = true;
+ }
+
+ return available;
+}
+
+void Adaptor::RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton)
+{
+ mToolkitAdaptor.mFunctionsCalled.RegisterSingleton = true;
+
+ if(singleton)
+ {
+ mSingletonContainer.insert(SingletonPair(info.name(), singleton));
+ }
+}
+
+Dali::BaseHandle Adaptor::GetSingleton(const std::type_info& info) const
+{
+ mToolkitAdaptor.mFunctionsCalled.GetSingleton = true;
+
+ Dali::BaseHandle object = Dali::BaseHandle();
+
+ SingletonConstIter iter = mSingletonContainer.find(info.name());
+ if(iter != mSingletonContainer.end())
+ {
+ object = (*iter).second;
+ }
+
+ return object;
+}
+
+Adaptor::AdaptorSignalV2& Adaptor::SignalResize()
+{
+ mToolkitAdaptor.mFunctionsCalled.SignalResize = true;
+ return mResizeSignal;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ToolkitAdaptor::ToolkitAdaptor()
+: mLastTouchPointFed(0, TouchPoint::Down, 0.0f, 0.0f),
+ mLastTimeStampFed(0),
+ mStyleMonitor(StyleMonitor::Get()),
+ mAccessibilityManager(AccessibilityManager::Get()),
+ mImfManager(ImfManager::Get()),
+ mAdaptorStub(new Adaptor(*this))
+{
+ gAdaptor = mAdaptorStub;
+}
+
+ToolkitAdaptor::~ToolkitAdaptor()
+{
+ delete mAdaptorStub;
+ gAdaptor = NULL;
+}
+
+void ToolkitAdaptor::EmitSignalResize()
+{
+ mAdaptorStub->EmitSignalResize();
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
+#define __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <boost/function.hpp>
+
+// INTERNAL INCLUDES
+#include "toolkit-style-monitor.h"
+#include "toolkit-accessibility-manager.h"
+#include "toolkit-timer.h"
+#include "toolkit-imf-manager.h"
+#include "toolkit-clipboard-event-notifier.h"
+
+#include <dali/public-api/events/touch-point.h>
+#include <dali/public-api/math/rect.h>
+
+namespace Dali
+{
+
+class Adaptor;
+
+typedef Dali::Rect<int> 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<void(void)> GetLastIdleAdded() const
+ {
+ return mLastIdleAdded;
+ }
+
+ TouchPoint GetLastTouchPointFed() const
+ {
+ return mLastTouchPointFed;
+ }
+
+ int GetLastTimeStampFed() const
+ {
+ return mLastTimeStampFed;
+ }
+
+ PositionSize GetLastSizeSet() const
+ {
+ return mLastSizeSet;
+ }
+
+ StyleMonitor& GetToolkitStyleMonitor()
+ {
+ return mStyleMonitor;
+ }
+
+ AccessibilityManager& GetAccessibilityManager()
+ {
+ return mAccessibilityManager;
+ }
+
+ ToolkitClipboardEventNotifier& GetClipboardEventNotifier()
+ {
+ return mClipboardEventNotifier;
+ }
+
+public: // Signal Emissions
+
+ void EmitSignalResize();
+
+public: // TEST FUNCTIONS
+
+ // Enumeration of Adaptor methods
+ enum TestFuncEnum
+ {
+ StartType,
+ PauseType,
+ ResumeType,
+ StopType,
+ AddIdleType,
+ FeedEventType,
+ MoveResizeType,
+ SurfaceResizedType,
+ ReplaceSurfaceType,
+ RenderSyncType,
+ GetSurfaceType,
+ GetType,
+ IsAvailableType,
+ RegisterSingletonType,
+ GetSingletonType,
+ SignalResizeType,
+ };
+
+ void Reset()
+ {
+ mFunctionsCalled.Reset();
+ }
+
+ bool WasCalled(TestFuncEnum func)
+ {
+ switch(func)
+ {
+ case StartType: return mFunctionsCalled.Start;
+ case PauseType: return mFunctionsCalled.Pause;
+ case ResumeType: return mFunctionsCalled.Resume;
+ case StopType: return mFunctionsCalled.Stop;
+ case AddIdleType: return mFunctionsCalled.AddIdle;
+ case FeedEventType: return mFunctionsCalled.FeedEvent;
+ case MoveResizeType: return mFunctionsCalled.MoveResize;
+ case SurfaceResizedType: return mFunctionsCalled.SurfaceResized;
+ case ReplaceSurfaceType: return mFunctionsCalled.ReplaceSurface;
+ case RenderSyncType: return mFunctionsCalled.RenderSync;
+ case GetSurfaceType: return mFunctionsCalled.GetSurface;
+ case GetType: return mFunctionsCalled.Get;
+ case IsAvailableType: return mFunctionsCalled.IsAvailable;
+ case RegisterSingletonType: return mFunctionsCalled.RegisterSingleton;
+ case GetSingletonType: return mFunctionsCalled.GetSingleton;
+ case SignalResizeType: return mFunctionsCalled.SignalResize;
+ }
+ return false;
+ }
+
+ void ResetCallStatistics(TestFuncEnum func)
+ {
+ switch(func)
+ {
+ case StartType: mFunctionsCalled.Start = false; break;
+ case PauseType: mFunctionsCalled.Pause = false; break;
+ case ResumeType: mFunctionsCalled.Resume = false; break;
+ case StopType: mFunctionsCalled.Stop = false; break;
+ case AddIdleType: mFunctionsCalled.AddIdle = false; break;
+ case FeedEventType: mFunctionsCalled.FeedEvent = false; break;
+ case MoveResizeType: mFunctionsCalled.MoveResize = false; break;
+ case SurfaceResizedType: mFunctionsCalled.SurfaceResized = false; break;
+ case ReplaceSurfaceType: mFunctionsCalled.ReplaceSurface = false; break;
+ case RenderSyncType: mFunctionsCalled.RenderSync = false; break;
+ case GetSurfaceType: mFunctionsCalled.GetSurface = false; break;
+ case GetType: mFunctionsCalled.Get = false; break;
+ case IsAvailableType: mFunctionsCalled.IsAvailable = false; break;
+ case RegisterSingletonType: mFunctionsCalled.RegisterSingleton = false; break;
+ case GetSingletonType: mFunctionsCalled.GetSingleton = false; break;
+ case SignalResizeType: mFunctionsCalled.SignalResize = false; break;
+ }
+ }
+
+private:
+
+ struct TestFunctions
+ {
+ TestFunctions()
+ : Start(false),
+ Pause(false),
+ Resume(false),
+ Stop(false),
+ AddIdle(false),
+ FeedEvent(false),
+ MoveResize(false),
+ SurfaceResized(false),
+ ReplaceSurface(false),
+ RenderSync(false),
+ GetSurface(false),
+ Get(false),
+ IsAvailable(false),
+ RegisterSingleton(false),
+ GetSingleton(false),
+ SignalResize(false)
+ {
+ }
+
+ void Reset()
+ {
+ Start = false;
+ Pause = false;
+ Resume = false;
+ Stop = false;
+ AddIdle = false;
+ FeedEvent = false;
+ MoveResize = false;
+ SurfaceResized = false;
+ ReplaceSurface = false;
+ RenderSync = false;
+ GetSurface = false;
+ Get = false;
+ IsAvailable = false;
+ RegisterSingleton = false;
+ GetSingleton = false;
+ SignalResize = false;
+ }
+
+ bool Start;
+ bool Pause;
+ bool Resume;
+ bool Stop;
+ bool AddIdle;
+ bool FeedEvent;
+ bool MoveResize;
+ bool SurfaceResized;
+ bool ReplaceSurface;
+ bool RenderSync;
+ bool GetSurface;
+ bool Get;
+ bool IsAvailable;
+ bool RegisterSingleton;
+ bool GetSingleton;
+ bool SignalResize;
+ };
+
+ TestFunctions mFunctionsCalled;
+
+ // Last set information
+ boost::function<void(void)> mLastIdleAdded;
+ TouchPoint mLastTouchPointFed;
+ int mLastTimeStampFed;
+ PositionSize mLastSizeSet;
+
+ // Contains Test functions for the Style Monitor
+ StyleMonitor mStyleMonitor;
+
+ // Stub for AccessibilityManager
+ AccessibilityManager mAccessibilityManager;
+
+ // Stub for ClipboardEventNotifier
+ ToolkitClipboardEventNotifier mClipboardEventNotifier;
+
+ ImfManager mImfManager;
+
+ // The Adaptor Stub
+ Adaptor* mAdaptorStub;
+ friend class Adaptor;
+};
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-application.h"
+
+#include <boost/any.hpp>
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+#include <dali/public-api/adaptor-framework/common/orientation.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
+#define __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+namespace Dali
+{
+
+class Application;
+
+/**
+ * This creates a stubbed Application so that Application calls work.
+ * Furthermore, it provides an interface to see if certain methods were invoked.
+ */
+class ToolkitApplication
+{
+public: // Construction & Destruction
+
+ ToolkitApplication();
+ ~ToolkitApplication();
+
+public: // Getters
+
+ Application& GetApplication();
+
+public: // Signal Emissions
+
+public: // TEST FUNCTIONS
+
+ // Enumeration of Application methods
+ enum TestFuncEnum
+ {
+ };
+
+ void Reset()
+ {
+ mFunctionsCalled.Reset();
+ }
+
+ bool WasCalled(TestFuncEnum func)
+ {
+ switch(func)
+ {
+ }
+ return false;
+ }
+
+ void ResetCallStatistics(TestFuncEnum func)
+ {
+ switch(func)
+ {
+ }
+ }
+
+private:
+
+ struct TestFunctions
+ {
+ TestFunctions()
+ {
+ }
+
+ void Reset()
+ {
+ }
+ };
+
+ TestFunctions mFunctionsCalled;
+
+ // The Application Stub
+ Application* mApplicationStub;
+ friend class Application;
+};
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TOOLKIT_APPLICATION_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-clipboard-event-notifier.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__
+#define __DALI_TOOLKIT_CLIPBOARD_EVENT_NOTIFIER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// PUBLIC INCLUDES
+#include <dali/public-api/adaptor-framework/common/clipboard-event-notifier.h>
+
+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__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-clipboard.h"
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Implementation of the Clip Board
+ */
+
+class Clipboard : public Dali::BaseObject
+{
+public:
+
+ /**
+ * @copydoc Dali::ClipboardEventNotifier::Get()
+ */
+ static Dali::Clipboard Get();
+
+ /**
+ * Constructor
+ * @param[in] ecoreXwin, The window is created by application.
+ */
+ Clipboard(/*Ecore_X_Window ecoreXwin*/);
+ virtual ~Clipboard();
+
+ /**
+ * @copydoc Dali::Clipboard::SetItem()
+ */
+ bool SetItem(const std::string &itemData);
+
+ /**
+ * @copydoc Dali::Clipboard::GetItem()
+ */
+ std::string GetItem( unsigned int index );
+
+ /**
+ * @copydoc Dali::Clipboard::NumberOfClipboardItems()
+ */
+ unsigned int NumberOfItems();
+
+ /**
+ * @copydoc Dali::Clipboard::ShowClipboard()
+ */
+ void ShowClipboard();
+
+ /**
+ * @copydoc Dali::Clipboard::HideClipboard()
+ */
+ void HideClipboard();
+
+
+private:
+ Clipboard( const Clipboard& );
+ Clipboard& operator=( Clipboard& );
+
+ static Dali::Clipboard mToolkitClipboard;
+}; // class clipboard
+
+
+Dali::Clipboard Dali::Internal::Adaptor::Clipboard::mToolkitClipboard;
+
+
+Clipboard::Clipboard( /*Ecore_X_Window ecoreXwin*/)
+{
+}
+
+Clipboard::~Clipboard()
+{
+}
+
+Dali::Clipboard Clipboard::Get()
+{
+ if( ! mToolkitClipboard )
+ {
+ mToolkitClipboard = Dali::Clipboard( new Dali::Internal::Adaptor::Clipboard() );
+ }
+ return mToolkitClipboard;
+}
+
+bool Clipboard::SetItem(const std::string &itemData )
+{
+ return true;
+}
+
+std::string Clipboard::GetItem( unsigned int index )
+{
+ return "";
+}
+
+unsigned int Clipboard::NumberOfItems()
+{
+ return 0;
+}
+
+void Clipboard::ShowClipboard()
+{
+}
+
+void Clipboard::HideClipboard()
+{
+}
+
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+
+inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard)
+{
+ // Bypass any passed in clipboard handle - it probably won't be initialized
+ Dali::Clipboard theClipboard = Dali::Clipboard::Get();
+ BaseObject& object = theClipboard.GetBaseObject();
+ return static_cast<Internal::Adaptor::Clipboard&>(object);
+}
+
+inline static const Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard)
+{
+ // Bypass any passed in clipboard handle - it probably won't be initialized
+ Dali::Clipboard theClipboard = Dali::Clipboard::Get();
+ const BaseObject& object = theClipboard.GetBaseObject();
+ return static_cast<const Internal::Adaptor::Clipboard&>(object);
+}
+
+
+Clipboard::Clipboard()
+{
+}
+Clipboard::~Clipboard()
+{
+}
+Clipboard::Clipboard(Internal::Adaptor::Clipboard *impl)
+ : BaseHandle(impl)
+{
+}
+
+Clipboard Clipboard::Get()
+{
+ return Internal::Adaptor::Clipboard::Get();
+}
+bool Clipboard::SetItem( const std::string &itemData)
+{
+ return GetImplementation(*this).SetItem( itemData );
+}
+
+std::string Clipboard::GetItem( unsigned int index )
+{
+ return GetImplementation(*this).GetItem( index );
+}
+
+unsigned int Clipboard::NumberOfItems()
+{
+ return GetImplementation(*this).NumberOfItems();
+}
+
+void Clipboard::ShowClipboard()
+{
+ GetImplementation(*this).ShowClipboard();
+}
+
+void Clipboard::HideClipboard()
+{
+ GetImplementation(*this).HideClipboard();
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __TOOLKIT_CLIPBOARD_H__
+#define __TOOLKIT_CLIPBOARD_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#define __DALI_CLIPBOARD_H__
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/object/base-handle.h>
+
+namespace Dali DALI_IMPORT_API
+{
+
+namespace Internal DALI_INTERNAL
+{
+
+namespace Adaptor
+{
+class Clipboard;
+}
+}
+
+/**
+ * The Clipboard can operate using various funtion.
+ * Clipboard can manage it's item and set show / hide status.
+ */
+class Clipboard : public BaseHandle
+{
+public:
+ /**
+ * Create an uninitialized Clipboard;
+ * this can be initialized with one of the derived Clipboard' New() methods
+ */
+ Clipboard();
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~Clipboard();
+
+ /**
+ * This constructor is used by Adaptor::GetClipboard().
+ * @param[in] clipboard A pointer to the clipboard.
+ */
+ Clipboard( Internal::Adaptor::Clipboard* clipboard );
+
+ /**
+ * Retrieve a handle to the ClipboardEventNotifier instance
+ * @return A handle to the Clipboard
+ */
+ static Clipboard Get();
+
+ /**
+ * Send the given string to the clipboard
+ * @param[in] itemData string to send to clip board
+ * @return bool true if the internal clip board sending was successful.
+ */
+ bool SetItem( const std::string& itemData );
+
+ /**
+ * Retreive the string at the given index in the clip board.
+ * @param[in] index item in clipboard list to retrieve
+ * @return string the text item at the current index.
+ */
+ std::string GetItem( unsigned int index );
+
+ /**
+ * Returns the number of item currently in the clipboard
+ * @return unsigned int number of clipboard items
+ */
+ unsigned int NumberOfItems();
+
+ /**
+ * Show the clipboard window
+ */
+ void ShowClipboard();
+
+ /**
+ * Hide the clipboard window
+ */
+ void HideClipboard();
+
+};
+} // namespace Dali
+
+#endif // __TOOLKIT_CLIPBOARD_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// CLASS HEADER
+#include "toolkit-imf-manager.h"
+
+// EXTERNAL INCLUDES
+#include <boost/bind.hpp>
+#include <Ecore_IMF.h>
+#include <Ecore_X.h>
+
+#include <dali/dali.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/events/key-event-integ.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class RenderSurface;
+
+
+class ImfManager : public Dali::BaseObject
+{
+public:
+ typedef Dali::ImfManager::ImfManagerSignalV2 ImfManagerSignalV2;
+ typedef Dali::ImfManager::ImfEventSignalV2 ImfEventSignalV2;
+
+public:
+ static Dali::ImfManager Get();
+
+ ImfManager( /* Ecore_X_Window ecoreXwin */ );
+ void ConnectCallbacks();
+ void DisconnectCallbacks();
+ void Activate();
+ void Deactivate();
+ void Reset();
+
+ Ecore_IMF_Context* GetContext();
+ bool RestoreAfterFocusLost() const;
+ void SetRestoreAferFocusLost( bool toggle );
+ void PreEditChanged( void *data, Ecore_IMF_Context *imfContext, void *event_info );
+ void CommitReceived( void *data, Ecore_IMF_Context *imfContext, void *event_info );
+ Eina_Bool RetrieveSurrounding( void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition );
+ void DeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info );
+ void NotifyCursorPosition();
+ int GetCursorPosition();
+ void SetCursorPosition( unsigned int cursorPosition );
+ void SetSurroundingText( std::string text );
+ std::string GetSurroundingText();
+
+public: // Signals
+ ImfManagerSignalV2& ActivatedSignal() { return mActivatedSignalV2; }
+ ImfEventSignalV2& EventReceivedSignal() { return mEventSignalV2; }
+
+protected:
+ virtual ~ImfManager();
+
+private:
+ void CreateContext( /*Ecore_X_Window ecoreXwin*/ );
+ void DeleteContext();
+
+private:
+ // Undefined
+ ImfManager( const ImfManager& );
+ ImfManager& operator=( ImfManager& );
+
+private:
+ Ecore_IMF_Context* mIMFContext;
+ int mIMFCursorPosition;
+ std::string mSurroundingText;
+ bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained.
+ bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected.
+
+ std::vector<Dali::Integration::KeyEvent> mKeyEvents; ///< Stores key events to be sent from idle call-back.
+ ImfManagerSignalV2 mActivatedSignalV2;
+ ImfEventSignalV2 mEventSignalV2;
+
+
+ static Dali::ImfManager mToolkitImfManager;
+
+public:
+
+inline static Internal::Adaptor::ImfManager& GetImplementation(Dali::ImfManager& imfManager)
+{
+ Dali::ImfManager actualImfManager = ImfManager::Get();
+
+ BaseObject& handle = actualImfManager.GetBaseObject();
+ return static_cast<Internal::Adaptor::ImfManager&>(handle);
+}
+
+inline static const Internal::Adaptor::ImfManager& GetImplementation(const Dali::ImfManager& imfManager)
+{
+ Dali::ImfManager actualImfManager = ImfManager::Get();
+
+ const BaseObject& handle = imfManager.GetBaseObject();
+ return static_cast<const Internal::Adaptor::ImfManager&>(handle);
+}
+
+};
+
+
+namespace
+{
+
+// Currently this code is internal to dali/dali/internal/event/text/utf8.h but should be made Public and used from there instead.
+size_t Utf8SequenceLength(const unsigned char leadByte)
+{
+ size_t length = 0;
+
+ if ((leadByte & 0x80) == 0 ) //ASCII character (lead bit zero)
+ {
+ length = 1;
+ }
+ else if (( leadByte & 0xe0 ) == 0xc0 ) //110x xxxx
+ {
+ length = 2;
+ }
+ else if (( leadByte & 0xf0 ) == 0xe0 ) //1110 xxxx
+ {
+ length = 3;
+ }
+ else if (( leadByte & 0xf8 ) == 0xf0 ) //1111 0xxx
+ {
+ length = 4;
+ }
+
+ return length;
+}
+
+// Static function calls used by ecore 'c' style callback registration
+void Commit( void *data, Ecore_IMF_Context *imfContext, void *event_info )
+{
+ if ( data )
+ {
+ ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
+ imfManager->CommitReceived( data, imfContext, event_info );
+ }
+}
+
+void PreEdit( void *data, Ecore_IMF_Context *imfContext, void *event_info )
+{
+ if ( data )
+ {
+ ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
+ imfManager->PreEditChanged( data, imfContext, event_info );
+ }
+}
+
+Eina_Bool ImfRetrieveSurrounding(void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition )
+{
+ if ( data )
+ {
+ ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
+ return imfManager->RetrieveSurrounding( data, imfContext, text, cursorPosition );
+ }
+ else
+ {
+ return false;
+ }
+}
+
+/**
+ * Called when an IMF delete surrounding event is received.
+ * Here we tell the application that it should delete a certain range.
+ */
+void ImfDeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info )
+{
+ if ( data )
+ {
+ ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
+ imfManager->DeleteSurrounding( data, imfContext, event_info );
+ }
+}
+
+} // unnamed namespace
+
+Dali::ImfManager Dali::Internal::Adaptor::ImfManager::mToolkitImfManager;
+
+
+Dali::ImfManager ImfManager::Get()
+{
+ Dali::ImfManager manager;
+
+ if( ! mToolkitImfManager )
+ {
+ mToolkitImfManager = Dali::ImfManager( new Dali::Internal::Adaptor::ImfManager() );
+ }
+ return mToolkitImfManager;
+}
+
+ImfManager::ImfManager( /*Ecore_X_Window ecoreXwin*/ )
+: mIMFContext(),
+ mIMFCursorPosition( 0 ),
+ mSurroundingText(""),
+ mRestoreAfterFocusLost( false ),
+ mIdleCallbackConnected( false ),
+ mKeyEvents()
+{
+ //ecore_imf_init();
+ CreateContext( /*ecoreXwin*/ );
+ ConnectCallbacks();
+ //VirtualKeyboard::ConnectCallbacks( mIMFContext );
+}
+
+ImfManager::~ImfManager()
+{
+ //VirtualKeyboard::DisconnectCallbacks( mIMFContext );
+ DisconnectCallbacks();
+ DeleteContext();
+ //ecore_imf_shutdown();
+}
+
+void ImfManager::CreateContext( /*Ecore_X_Window ecoreXwin*/ )
+{
+}
+
+void ImfManager::DeleteContext()
+{
+}
+
+// Callbacks for predicitive text support.
+void ImfManager::ConnectCallbacks()
+{
+ //if ( mIMFContext ) {
+ //ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, PreEdit, this );
+ //ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit, this );
+ //ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding, this );
+ //}
+}
+
+void ImfManager::DisconnectCallbacks()
+{
+ // if ( mIMFContext )
+ // {
+ // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, PreEdit );
+ // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit );
+ // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding );
+ // }
+}
+
+void ImfManager::Activate()
+{
+ // // Reset mIdleCallbackConnected
+ // mIdleCallbackConnected = false;
+
+ // if ( mIMFContext )
+ // {
+ // ecore_imf_context_focus_in( mIMFContext );
+ // // emit keyboard activated signal
+ // Dali::ImfManager handle( this );
+ // mActivatedSignalV2.Emit( handle );
+ // }
+}
+
+void ImfManager::Deactivate()
+{
+ // if( mIMFContext )
+ // {
+ // Reset();
+ // ecore_imf_context_focus_out( mIMFContext );
+ // }
+ // // Reset mIdleCallbackConnected
+ // mIdleCallbackConnected = false;
+}
+
+void ImfManager::Reset()
+{
+ // if ( mIMFContext )
+ // {
+ // ecore_imf_context_reset( mIMFContext );
+ // }
+}
+
+Ecore_IMF_Context* ImfManager::GetContext()
+{
+ //return mIMFContext;
+ return NULL;
+}
+
+bool ImfManager::RestoreAfterFocusLost() const
+{
+ return mRestoreAfterFocusLost;
+}
+
+void ImfManager::SetRestoreAferFocusLost( bool toggle )
+{
+ mRestoreAfterFocusLost = toggle;
+}
+
+void ImfManager::PreEditChanged( void *, Ecore_IMF_Context *imfContext, void *event_info )
+{
+ // char *preEditString( NULL );
+ // int cursorPosition( 0 );
+ // Eina_List *attrs = NULL;
+ // Eina_List *l = NULL;
+
+ // Ecore_IMF_Preedit_Attr *attr;
+
+ // // Retrieves attributes as well as the string the cursor position offset from start of pre-edit string.
+ // // the attributes (attrs) is used in languages that use the soft arrows keys to insert characters into a current pre-edit string.
+ // ecore_imf_context_preedit_string_with_attributes_get( imfContext, &preEditString, &attrs, &cursorPosition );
+ // if ( attrs )
+ // {
+ // // iterate through the list of attributes getting the type, start and end position.
+ // for ( l = attrs, (attr = (Ecore_IMF_Preedit_Attr*)eina_list_data_get(l) ); l; l = eina_list_next(l), ( attr = (Ecore_IMF_Preedit_Attr*)eina_list_data_get(l) ))
+ // {
+ // if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB4 ) // (Ecore_IMF)
+ // {
+ // // check first byte so know how many bytes a character is represented by as keyboard returns cursor position in bytes. Which is different for some languages.
+ // size_t visualCharacterIndex = 0;
+ // size_t byteIndex = 0;
+ // // iterate through null terminated string checking each character's position against the given byte position ( attr->end_index ).
+ // while ( preEditString[byteIndex] != '\0' )
+ // {
+ // // attr->end_index is provided as a byte position not character and we need to know the character position.
+ // size_t currentSequenceLength = Utf8SequenceLength(preEditString[byteIndex]); // returns number of bytes used to represent character.
+ // if ( byteIndex == attr->end_index )
+ // {
+ // cursorPosition = visualCharacterIndex;
+ // break;
+ // // end loop as found cursor position that matches byte position
+ // }
+ // else
+ // {
+ // byteIndex += currentSequenceLength; // jump to next character
+ // visualCharacterIndex++; // increment character count so we know our position for when we get a match
+ // }
+ // DALI_ASSERT_DEBUG( visualCharacterIndex < strlen( preEditString ));
+ // }
+ // }
+ // }
+ // }
+ // if ( Dali::Adaptor::IsAvailable() )
+ // {
+ // std::string keyString ( preEditString );
+ // int numberOfChars( 0 );
+ // Dali::ImfManager handle( this );
+ // Dali::ImfManager::ImfEventData imfEventData ( Dali::ImfManager::PREEDIT, keyString, cursorPosition, numberOfChars );
+ // Dali::ImfManager::ImfCallbackData callbackData = mEventSignalV2.Emit( handle, imfEventData );
+ // if ( callbackData.update )
+ // {
+ // SetCursorPosition( callbackData.cursorPosition );
+ // SetSurroundingText( callbackData.currentText );
+ // NotifyCursorPosition();
+ // }
+ // if ( callbackData.preeditResetRequired )
+ // {
+ // Reset();
+ // }
+ // }
+ // free( preEditString );
+}
+
+void ImfManager::CommitReceived( void *, Ecore_IMF_Context *imfContext, void *event_info )
+{
+ // if ( Dali::Adaptor::IsAvailable() )
+ // {
+ // const std::string keyString( (char *)event_info );
+ // const int cursorOffset( 0 );
+ // const int numberOfChars( 0 );
+
+ // Dali::ImfManager handle( this );
+ // Dali::ImfManager::ImfEventData imfEventData ( Dali::ImfManager::COMMIT, keyString, cursorOffset, numberOfChars );
+ // Dali::ImfManager::ImfCallbackData callbackData = mEventSignalV2.Emit( handle, imfEventData );
+
+ // if ( callbackData.update )
+ // {
+ // SetCursorPosition( callbackData.cursorPosition );
+ // SetSurroundingText( callbackData.currentText );
+
+ // NotifyCursorPosition();
+ // }
+ // }
+}
+
+/**
+ * Called when an IMF retrieve surround event is received.
+ * Here the IMF module wishes to know the string we are working with and where within the string the cursor is
+ * We need to signal the application to tell us this information.
+ */
+Eina_Bool ImfManager::RetrieveSurrounding( void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition )
+{
+ // std::string keyString ( "" );
+ // int cursorOffset( 0 );
+ // int numberOfChars( 0 );
+ // Dali::ImfManager::ImfEventData imfData ( Dali::ImfManager::GETSURROUNDING , keyString, cursorOffset, numberOfChars );
+ // Dali::ImfManager handle( this );
+ // mEventSignalV2.Emit( handle, imfData );
+ // if ( text )
+ // {
+ // std::string surroundingText( GetSurroundingText() );
+ // if ( !surroundingText.empty() )
+ // {
+ // *text = strdup( surroundingText.c_str() );
+ // }
+ // else
+ // {
+ // *text = strdup( "" );
+ // }
+ // }
+ // if ( cursorPosition )
+ // {
+ // *cursorPosition = GetCursorPosition();
+ // }
+ return EINA_TRUE;
+}
+
+/**
+ * Called when an IMF delete surrounding event is received.
+ * Here we tell the application that it should delete a certain range.
+ */
+void ImfManager::DeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info )
+{
+ // if ( Dali::Adaptor::IsAvailable() )
+ // {
+ // Ecore_IMF_Event_Delete_Surrounding* deleteSurroundingEvent = (Ecore_IMF_Event_Delete_Surrounding*) event_info;
+ // const std::string keyString( "" );
+ // const int cursorOffset( deleteSurroundingEvent->offset );
+ // const int numberOfChars( deleteSurroundingEvent->n_chars );
+ // Dali::ImfManager::ImfEventData imfData ( Dali::ImfManager::DELETESURROUNDING , keyString, cursorOffset, numberOfChars );
+ // Dali::ImfManager handle( this );
+ // mEventSignalV2.Emit( handle, imfData );
+ // }
+}
+
+void ImfManager::NotifyCursorPosition()
+{
+ // if ( mIMFContext )
+ // {
+ // ecore_imf_context_cursor_position_set( mIMFContext, mIMFCursorPosition );
+ // }
+}
+
+int ImfManager::GetCursorPosition()
+{
+ return mIMFCursorPosition;
+}
+
+void ImfManager::SetCursorPosition( unsigned int cursorPosition )
+{
+ mIMFCursorPosition = ( int )cursorPosition;
+}
+
+void ImfManager::SetSurroundingText( std::string text )
+{
+ mSurroundingText = text;
+}
+
+std::string ImfManager::GetSurroundingText()
+{
+ return mSurroundingText;
+}
+
+} // Adaptor
+
+} // Internal
+
+
+/********************************************************************************/
+/********************************* PUBLIC CLASS *******************************/
+/********************************************************************************/
+
+ImfManager::ImfManager()
+{
+}
+
+ImfManager::~ImfManager()
+{
+}
+
+ImfManager ImfManager::Get()
+{
+ return Internal::Adaptor::ImfManager::Get();
+}
+
+ImfContext ImfManager::GetContext()
+{
+ return reinterpret_cast<ImfContext>( Internal::Adaptor::ImfManager::GetImplementation(*this).GetContext() );
+}
+
+void ImfManager::Activate()
+{
+ Internal::Adaptor::ImfManager::GetImplementation(*this).Activate();
+}
+
+void ImfManager::Deactivate()
+{
+ Internal::Adaptor::ImfManager::GetImplementation(*this).Deactivate();
+}
+
+bool ImfManager::RestoreAfterFocusLost() const
+{
+ return Internal::Adaptor::ImfManager::GetImplementation(*this).RestoreAfterFocusLost();
+}
+
+void ImfManager::SetRestoreAferFocusLost( bool toggle )
+{
+ Internal::Adaptor::ImfManager::GetImplementation(*this).SetRestoreAferFocusLost( toggle );
+}
+
+void ImfManager::Reset()
+{
+ Internal::Adaptor::ImfManager::GetImplementation(*this).Reset();
+}
+
+void ImfManager::NotifyCursorPosition()
+{
+ Internal::Adaptor::ImfManager::GetImplementation(*this).NotifyCursorPosition();
+}
+
+void ImfManager::SetCursorPosition( unsigned int SetCursorPosition )
+{
+ Internal::Adaptor::ImfManager::GetImplementation(*this).SetCursorPosition( SetCursorPosition );
+}
+
+int ImfManager::GetCursorPosition()
+{
+ return Internal::Adaptor::ImfManager::GetImplementation(*this).GetCursorPosition();
+}
+
+void ImfManager::SetSurroundingText( std::string text )
+{
+ Internal::Adaptor::ImfManager::GetImplementation(*this).SetSurroundingText( text );
+}
+
+std::string ImfManager::GetSurroundingText()
+{
+ return Internal::Adaptor::ImfManager::GetImplementation(*this).GetSurroundingText();
+}
+
+ImfManager::ImfManagerSignalV2& ImfManager::ActivatedSignal()
+{
+ return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal();
+}
+
+ImfManager::ImfEventSignalV2& ImfManager::EventReceivedSignal()
+{
+ return Internal::Adaptor::ImfManager::GetImplementation(*this).EventReceivedSignal();
+}
+
+ImfManager::ImfManager(Internal::Adaptor::ImfManager *impl)
+ : BaseHandle(impl)
+{
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef _DALI_ADAPTOR_IMF_MANAGER_H_
+#define _DALI_ADAPTOR_IMF_MANAGER_H_
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#define IMFMANAGER_H
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+namespace Dali DALI_IMPORT_API
+{
+
+namespace Internal DALI_INTERNAL
+{
+namespace Adaptor
+{
+class ImfManager;
+}
+}
+
+typedef void* ImfContext;
+
+/**
+ * @brief The ImfManager class
+ * Specifically manages the ecore input method framework which enables the virtual or hardware keyboards.
+ */
+class ImfManager : public BaseHandle
+{
+public:
+
+ enum ImfEvent
+ {
+ VOID,
+ PREEDIT,
+ COMMIT,
+ DELETESURROUNDING,
+ GETSURROUNDING
+ };
+
+ /**
+ * This structure is used to pass on data from the IMF regarding predictive text.
+ */
+ struct ImfEventData
+ {
+ /**
+ * Default Constructor.
+ */
+ ImfEventData()
+ : eventName( VOID ),
+ predictiveString(""),
+ cursorOffset( 0 ),
+ numberOfChars ( 0 )
+ {
+ };
+
+ /**
+ * Constructor
+ * @param[in] aEventName The name of the event from the IMF.
+ * @param[in] aPredictiveString The pre-edit or commit string.
+ * @param[in] aCursorOffset Start position from the current cursor position to start deleting characters.
+ * @param[in] aNumberOfChars The number of characters to delete from the cursorOffset.
+ */
+ ImfEventData(ImfEvent aEventName, const std::string& aPredictiveString, int aCursorOffset,int aNumberOfChars )
+ : eventName(aEventName), predictiveString(aPredictiveString), cursorOffset( aCursorOffset ), numberOfChars( aNumberOfChars )
+ {
+ }
+
+ // Data
+ ImfEvent eventName; // The name of the event from the IMF.
+ std::string predictiveString; // The pre-edit or commit string.
+ int cursorOffset; // Start position from the current cursor position to start deleting characters.
+ int numberOfChars; //number of characters to delete from the cursorOffset.
+ };
+
+ /**
+ * Data required my IMF from the callback
+ */
+ struct ImfCallbackData
+ {
+ ImfCallbackData( )
+ : update( false ), cursorPosition( 0 ), preeditResetRequired ( false )
+ {
+ }
+
+ ImfCallbackData(bool aUpdate, int aCursorPosition, std::string aCurrentText, bool aPreeditResetRequired )
+ : update(aUpdate), cursorPosition(aCursorPosition), currentText( aCurrentText ), preeditResetRequired( aPreeditResetRequired )
+ {
+ }
+
+ bool update; // if cursor position needs to be updated
+ int cursorPosition; // new position of cursor
+ std::string currentText; // current text string
+ bool preeditResetRequired; // flag if preedit reset is required.
+ };
+
+ typedef SignalV2< void (ImfManager&) > ImfManagerSignalV2;
+
+ typedef SignalV2< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalV2;
+
+public:
+
+ /**
+ * Retrieve a handle to the instance of ImfManager.
+ * @return A handle to the ImfManager.
+ */
+ static ImfManager Get();
+
+ /**
+ * Get the current imf context.
+ * @return current imf context.
+ */
+ ImfContext GetContext();
+
+ /**
+ * Activate the IMF.
+ * It means that the text editing is started at somewhere.
+ * If the H/W keyboard isn't connected then it will show the virtual keyboard.
+ */
+ void Activate();
+
+ /**
+ * Deactivate the IMF.
+ * It means that the text editing is finished at somewhere.
+ */
+ void Deactivate();
+
+ /**
+ * Get the restoration status, which controls if the keyboard is restored after the focus lost then regained.
+ * If true then keyboard will be restored (activated) after focus is regained.
+ * @return restoration status.
+ */
+ bool RestoreAfterFocusLost() const;
+
+ /**
+ * Set status whether the IMF has to restore the keyboard after losing focus.
+ * @param[in] toggle True means that keyboard should be restored after focus lost and regained.
+ */
+ void SetRestoreAferFocusLost( bool toggle );
+
+ /**
+ * Send message reset the pred-edit state / imf module. Used to interupt pre-edit state maybe due to a touch input.
+ */
+ void Reset();
+
+ /**
+ * Notifies IMF context that the cursor position has changed, required for features like auto-capitalisation
+ */
+ void NotifyCursorPosition();
+
+ /**
+ * Sets cursor position stored in VirtualKeyboard, this is required by the IMF context
+ * @param[in] cursorPosition position of cursor
+ */
+ void SetCursorPosition( unsigned int cursorPosition );
+
+ /**
+ * Gets cursor position stored in VirtualKeyboard, this is required by the IMF context
+ * @return current position of cursor
+ */
+ int GetCursorPosition();
+
+ /**
+ * Method to store the string required by the IMF, this is used to provide predictive word suggestions.
+ * @param[in] text The text string surrounding the current cursor point.
+ */
+ void SetSurroundingText( std::string text );
+
+ /**
+ * Gets current text string set within the IMF manager, this is used to offer predictive suggestions
+ * @return current position of cursor
+ */
+ std::string GetSurroundingText();
+
+public:
+
+ // Signals
+
+ /**
+ * This is emitted when the virtual keyboard is connected to or the hardware keyboard is activated.
+ * @return The IMF Activated signal.
+ */
+ ImfManagerSignalV2& ActivatedSignal();
+
+ /**
+ * This is emitted when the IMF manager receives an event from the IMF
+ * @return The Event signal containing the event data.
+ */
+ ImfEventSignalV2& EventReceivedSignal();
+
+ // Construction & Destruction
+
+ /**
+ * Constructor
+ */
+ ImfManager();
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~ImfManager();
+
+ /**
+ * This constructor is used by ImfManager::Get().
+ * @param[in] imfManager A pointer to the imf Manager.
+ */
+ ImfManager( Internal::Adaptor::ImfManager* imfManager );
+};
+
+} // namespace Dali
+
+#endif // _DALI_ADAPTOR_IMF_MANAGER_H_
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-orientation.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+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
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__
+#define __DALI_TOOLKIT_TOOLKIT_ORIENTATION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/common/orientation.h>
+
+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__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-physical-keyboard.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+namespace Dali
+{
+
+/********************************************************************************
+ * Stub for Dali::Internal::Adaptor::PhysicalKeyboard
+ ********************************************************************************/
+namespace Internal
+{
+namespace Adaptor
+{
+class PhysicalKeyboard : public BaseObject
+{
+public: // Creation & Destruction
+
+ PhysicalKeyboard();
+ ~PhysicalKeyboard();
+ static Dali::PhysicalKeyboard Get();
+
+public:
+ bool IsAttached() const;
+
+public: // Signals
+ Dali::PhysicalKeyboard::Signal& StatusChangedSignal();
+
+private:
+ Dali::PhysicalKeyboard::Signal mStatusChangedSignal;
+ bool mIsAttached;
+ static Dali::PhysicalKeyboard mPhysicalKeyboard;
+};
+
+Dali::PhysicalKeyboard PhysicalKeyboard::mPhysicalKeyboard;
+
+PhysicalKeyboard::PhysicalKeyboard()
+: mIsAttached(true)
+{
+}
+
+PhysicalKeyboard::~PhysicalKeyboard()
+{
+}
+
+Dali::PhysicalKeyboard PhysicalKeyboard::Get()
+{
+ if( ! mPhysicalKeyboard )
+ {
+ mPhysicalKeyboard = Dali::PhysicalKeyboard(new Internal::Adaptor::PhysicalKeyboard());
+ }
+ return mPhysicalKeyboard;
+}
+
+bool PhysicalKeyboard::IsAttached() const
+{
+ return mIsAttached;
+}
+
+Dali::PhysicalKeyboard::Signal& PhysicalKeyboard::StatusChangedSignal()
+{
+ return mStatusChangedSignal;
+}
+
+} // namespace Adaptor
+} // namespace Internal
+
+
+/********************************************************************************
+ * Stub for Dali::PhysicalKeyboard
+ ********************************************************************************/
+
+PhysicalKeyboard::PhysicalKeyboard(){}
+PhysicalKeyboard::~PhysicalKeyboard(){}
+
+PhysicalKeyboard PhysicalKeyboard::Get()
+{
+ // Get the physical keyboard handle
+ PhysicalKeyboard handle = Internal::Adaptor::PhysicalKeyboard::Get();
+ return handle;
+}
+
+bool PhysicalKeyboard::IsAttached() const
+{
+ const BaseObject& object = GetBaseObject();
+ const Internal::Adaptor::PhysicalKeyboard& pyke = static_cast< const Internal::Adaptor::PhysicalKeyboard& >( object );
+ return pyke.IsAttached();
+}
+
+PhysicalKeyboard::Signal& PhysicalKeyboard::StatusChangedSignal()
+{
+ BaseObject& object = GetBaseObject();
+ Internal::Adaptor::PhysicalKeyboard& pyke = static_cast< Internal::Adaptor::PhysicalKeyboard& >( object );
+ return pyke.StatusChangedSignal();
+}
+
+PhysicalKeyboard::PhysicalKeyboard( Internal::Adaptor::PhysicalKeyboard *impl )
+: BaseHandle(impl)
+{
+}
+
+
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__
+#define __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class PhysicalKeyboard;
+}
+}
+
+class PhysicalKeyboard : public BaseHandle
+{
+public:
+ typedef SignalV2< void (PhysicalKeyboard) > Signal;
+ PhysicalKeyboard();
+ virtual ~PhysicalKeyboard();
+ static PhysicalKeyboard Get();
+ bool IsAttached() const;
+ Signal& StatusChangedSignal();
+ PhysicalKeyboard( Internal::Adaptor::PhysicalKeyboard* impl );
+};
+
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_PHYSICAL_KEYBOARD_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-style-monitor.h"
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+namespace Dali
+{
+
+
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * Stub for the StyleMonitor
+ */
+class StyleMonitor : public BaseObject
+{
+public: // Creation & Destruction
+ static Dali::StyleMonitor Get();
+ StyleMonitor();
+ ~StyleMonitor();
+
+public: // Style Information
+ std::string GetDefaultFontFamily() const;
+ float GetDefaultFontSize() const;
+ const std::string& GetTheme() const;
+ void SetTheme(std::string theme);
+
+public: // Signals
+ Dali::StyleMonitor::StyleChangeSignalV2& StyleChangeSignal();
+
+ void EmitStyleChangeSignal(StyleChange styleChange)
+ {
+ mStyleChangeSignal.Emit(Dali::StyleMonitor(this), styleChange);
+ }
+
+private:
+ Dali::StyleMonitor::StyleChangeSignalV2 mStyleChangeSignal;
+ static Dali::StyleMonitor mToolkitStyleMonitor;
+ std::string mTheme;
+};
+
+Dali::StyleMonitor StyleMonitor::mToolkitStyleMonitor;
+
+Dali::StyleMonitor StyleMonitor::Get()
+{
+ if( ! mToolkitStyleMonitor )
+ {
+ mToolkitStyleMonitor = Dali::StyleMonitor( new Dali::Internal::Adaptor::StyleMonitor() );
+ }
+ return mToolkitStyleMonitor;
+}
+
+StyleMonitor::StyleMonitor()
+: mTheme("default")
+{
+}
+
+StyleMonitor::~StyleMonitor()
+{
+}
+
+std::string StyleMonitor::GetDefaultFontFamily() const
+{
+ return Dali::StyleMonitor::DEFAULT_FONT_FAMILY;
+}
+
+float StyleMonitor::GetDefaultFontSize() const
+{
+ return Dali::StyleMonitor::DEFAULT_FONT_SIZE;
+}
+
+const std::string& StyleMonitor::GetTheme() const
+{
+ return mTheme;
+}
+
+void StyleMonitor::SetTheme(std::string path)
+{
+ StyleChange styleChange;
+ styleChange.themeChange = true;
+ styleChange.themeFilePath = path;
+ mTheme = path;
+ EmitStyleChangeSignal(styleChange);
+}
+
+Dali::StyleMonitor::StyleChangeSignalV2& StyleMonitor::StyleChangeSignal()
+{
+ return mStyleChangeSignal;
+}
+
+} // namespace Adaptor
+} // namespace Internal
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Internal::Adaptor::StyleMonitor& GetImplementation(Dali::StyleMonitor& monitor)
+{
+ BaseObject& object = monitor.GetBaseObject();
+ return static_cast<Internal::Adaptor::StyleMonitor&>(object);
+}
+const Internal::Adaptor::StyleMonitor& GetImplementation(const Dali::StyleMonitor& monitor)
+{
+ const BaseObject& object = monitor.GetBaseObject();
+ return static_cast<const Internal::Adaptor::StyleMonitor&>(object);
+}
+
+const std::string Dali::StyleMonitor::DEFAULT_FONT_FAMILY("DefaultFont");
+const float Dali::StyleMonitor::DEFAULT_FONT_SIZE(1.0f);
+
+StyleMonitor::StyleMonitor()
+{
+}
+
+StyleMonitor::StyleMonitor(const StyleMonitor& monitor)
+: BaseHandle(monitor)
+{
+}
+
+StyleMonitor StyleMonitor::StyleMonitor::Get()
+{
+ return Internal::Adaptor::StyleMonitor::Get();
+}
+
+StyleMonitor::~StyleMonitor()
+{
+}
+
+std::string StyleMonitor::GetDefaultFontFamily() const
+{
+ return GetImplementation(*this).GetDefaultFontFamily();
+}
+
+float StyleMonitor::GetDefaultFontSize() const
+{
+ return GetImplementation(*this).GetDefaultFontSize();
+}
+
+const std::string& StyleMonitor::GetTheme() const
+{
+ return GetImplementation(*this).GetTheme();
+}
+
+void StyleMonitor::SetTheme(std::string themeFilePath)
+{
+ GetImplementation(*this).SetTheme(themeFilePath);
+}
+
+StyleMonitor::StyleChangeSignalV2& StyleMonitor::StyleChangeSignal()
+{
+ return GetImplementation(*this).StyleChangeSignal();
+}
+
+void StyleMonitor::EmitStyleChangeSignal(StyleChange styleChange)
+{
+ GetImplementation(*this).EmitStyleChangeSignal(styleChange);
+}
+
+StyleMonitor& StyleMonitor::operator=(const StyleMonitor& monitor)
+{
+ if( *this != monitor )
+ {
+ BaseHandle::operator=(monitor);
+ }
+ return *this;
+}
+
+StyleMonitor::StyleMonitor(Internal::Adaptor::StyleMonitor* internal)
+: BaseHandle(internal)
+{
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__
+#define __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#define __DALI_STYLE_MONITOR_H__
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+#include <dali/public-api/adaptor-framework/common/style-change.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+namespace Adaptor
+{
+class StyleMonitor;
+}
+}
+
+class StyleMonitor : public BaseHandle
+{
+public: // Typedefs
+ typedef SignalV2< void (StyleMonitor, StyleChange) > StyleChangeSignalV2;
+ static const std::string DEFAULT_FONT_FAMILY;
+ static const float DEFAULT_FONT_SIZE;
+
+public: // Creation & Destruction
+ StyleMonitor();
+ StyleMonitor(const StyleMonitor& monitor);
+ static StyleMonitor Get();
+ virtual ~StyleMonitor();
+ static StyleMonitor DownCast( BaseHandle handle );
+ using BaseHandle::operator=;
+
+public: // Style Information
+ std::string GetDefaultFontFamily() const;
+ float GetDefaultFontSize() const;
+ const std::string& GetTheme() const;
+ void SetTheme(std::string themeFilePath);
+
+public: // Signals
+ StyleChangeSignalV2& StyleChangeSignal();
+ void EmitStyleChangeSignal(StyleChange handle);
+
+public: // Operators
+ StyleMonitor& operator=(const StyleMonitor& monitor);
+
+public:
+ StyleMonitor(Internal::Adaptor::StyleMonitor* styleMonitor);
+};
+
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TOOLKIT_STYLE_MONITOR_H__
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEST_APPLICATION_H__
+#define __DALI_TOOLKIT_TEST_APPLICATION_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali-test-suite-utils.h>
+
+#include "toolkit-adaptor.h"
+#include "toolkit-orientation.h"
+
+namespace Dali
+{
+
+/**
+ * Adds some functionality on top of TestApplication that is required by the Toolkit.
+ */
+class ToolkitTestApplication : public TestApplication
+{
+public:
+
+ ToolkitTestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
+ size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
+ float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
+ float verticalDpi = DEFAULT_VERTICAL_DPI )
+ : TestApplication( false, surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi )
+ {
+ Initialize();
+ }
+
+ ~ToolkitTestApplication()
+ {
+ // Need to delete core before we delete the adaptor.
+ delete mCore;
+ mCore = NULL;
+ }
+
+ inline ToolkitAdaptor& GetAdaptor()
+ {
+ return mAdaptor;
+ }
+
+ //ToolkitOrientation& GetOrientation()
+ //{
+ //return mOrientation;
+ //}
+
+private:
+ ToolkitAdaptor mAdaptor;
+ //ToolkitOrientation mOrientation;
+};
+
+} // namespace Dali
+
+inline ImageActor CreateSolidColorImageActor(ToolkitTestApplication& application, const Vector4& color, int width, int height)
+{
+ ImageActor actor = ImageActor::New(CreateBitmapImage(width, height, color));
+ application.SendNotification();
+ application.Render();
+ return actor;
+}
+
+
+#endif // __DALI_TOOLKIT_TEST_APPLICATION_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "toolkit-timer.h"
+
+#include <Ecore.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+
+namespace
+{
+bool ecore_timer_running = false;
+Ecore_Task_Cb timer_callback_func=NULL;
+const void* timer_callback_data=NULL;
+int timerId = 0;
+}// anon namespace
+
+extern "C"
+{
+Ecore_Timer* ecore_timer_add(double in,
+ Ecore_Task_Cb func,
+ const void *data)
+{
+ ecore_timer_running = true;
+ timer_callback_func = func;
+ timer_callback_data = data;
+ timerId += sizeof(Ecore_Timer*);
+ return (Ecore_Timer*)timerId;
+}
+
+void* ecore_timer_del(Ecore_Timer *timer)
+{
+ ecore_timer_running = false;
+ timer_callback_func = NULL;
+ return NULL;
+}
+
+}
--- /dev/null
+#ifndef __DALI_TOOLKIT_TOOLKIT_TIMER_H__
+#define __DALI_TOOLKIT_TOOLKIT_TIMER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// PUBLIC INCLUDES
+#define __DALI_TIMER_H__
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
+namespace Dali
+{
+
+class Timer : public BaseHandle
+{
+public:
+ typedef SignalV2< bool () > TimerSignalV2;
+ static Timer New( unsigned int milliSec );
+ Timer();
+ Timer( const Timer& timer );
+ Timer& operator=( const Timer& timer );
+ virtual ~Timer();
+ static Timer DownCast( BaseHandle handle );
+ using BaseHandle::operator=;
+ void Start();
+ void Stop();
+ void SetInterval( unsigned int milliSec );
+ unsigned int GetInterval() const;
+ bool IsRunning() const;
+ TimerSignalV2& TickSignal();
+private:
+ Dali::Timer::TimerSignalV2 mTickSignal;
+ unsigned int mInterval;
+ bool mIsRunning;
+};
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TOOLKIT_TIMER_H__
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include "tct-dali-toolkit-core.h"
+
+int main(int argc, const char *argv[])
+{
+ int result = -1;
+ int i;
+
+ if (argc != 2) {
+ printf("Usage: %s <testcase name>\n", argv[0]);
+ return 2;
+ }
+
+ for (i = 0; tc_array[i].name; i++) {
+ if (!strcmp(argv[1], tc_array[i].name)) {
+ if (tc_array[i].startup)
+ tc_array[i].startup();
+
+ result = tc_array[i].function();
+
+ if (tc_array[i].cleanup)
+ tc_array[i].cleanup();
+
+ return result;
+ }
+ }
+
+ printf("Unknown testcase name: \"%s\"\n", argv[1]);
+ return 2;
+}
--- /dev/null
+#ifndef __TCT_DALI_TOOLKIT_CORE_H__
+#define __TCT_DALI_TOOLKIT_CORE_H__
+
+#include "testcase.h"
+
+extern void utc_dali_toolkit_alignment_startup(void);
+extern void utc_dali_toolkit_alignment_cleanup(void);
+extern void utc_dali_toolkit_bubble_emitter_startup(void);
+extern void utc_dali_toolkit_bubble_emitter_cleanup(void);
+extern void utc_dali_toolkit_button_startup(void);
+extern void utc_dali_toolkit_button_cleanup(void);
+extern void utc_dali_toolkit_control_startup(void);
+extern void utc_dali_toolkit_control_cleanup(void);
+extern void utc_dali_toolkit_control_impl_startup(void);
+extern void utc_dali_toolkit_control_impl_cleanup(void);
+extern void utc_dali_toolkit_default_controls_startup(void);
+extern void utc_dali_toolkit_default_controls_cleanup(void);
+extern void utc_dali_toolkit_dissolve_effect_startup(void);
+extern void utc_dali_toolkit_dissolve_effect_cleanup(void);
+extern void utc_dali_toolkit_focus_manager_startup(void);
+extern void utc_dali_toolkit_focus_manager_cleanup(void);
+extern void utc_dali_toolkit_grid_layout_startup(void);
+extern void utc_dali_toolkit_grid_layout_cleanup(void);
+extern void utc_dali_toolkit_iris_effect_startup(void);
+extern void utc_dali_toolkit_iris_effect_cleanup(void);
+extern void utc_dali_toolkit_item_view_startup(void);
+extern void utc_dali_toolkit_item_view_cleanup(void);
+extern void utc_dali_toolkit_keyboard_focus_manager_startup(void);
+extern void utc_dali_toolkit_keyboard_focus_manager_cleanup(void);
+extern void utc_dali_toolkit_markup_processor_startup(void);
+extern void utc_dali_toolkit_markup_processor_cleanup(void);
+extern void utc_dali_toolkit_mask_effect_startup(void);
+extern void utc_dali_toolkit_mask_effect_cleanup(void);
+extern void utc_dali_toolkit_nine_patch_startup(void);
+extern void utc_dali_toolkit_nine_patch_cleanup(void);
+extern void utc_dali_toolkit_popup_startup(void);
+extern void utc_dali_toolkit_popup_cleanup(void);
+extern void utc_dali_toolkit_pushbutton_startup(void);
+extern void utc_dali_toolkit_pushbutton_cleanup(void);
+extern void utc_dali_toolkit_ripple_2d_effect_startup(void);
+extern void utc_dali_toolkit_ripple_2d_effect_cleanup(void);
+extern void utc_dali_toolkit_ripple_effect_startup(void);
+extern void utc_dali_toolkit_ripple_effect_cleanup(void);
+extern void utc_dali_toolkit_scroll_view_effect_startup(void);
+extern void utc_dali_toolkit_scroll_view_effect_cleanup(void);
+extern void utc_dali_toolkit_super_blur_view_startup(void);
+extern void utc_dali_toolkit_super_blur_view_cleanup(void);
+extern void utc_dali_toolkit_swirl_effect_startup(void);
+extern void utc_dali_toolkit_swirl_effect_cleanup(void);
+extern void utc_dali_toolkit_text_input_startup(void);
+extern void utc_dali_toolkit_text_input_cleanup(void);
+extern void utc_dali_toolkit_text_view_startup(void);
+extern void utc_dali_toolkit_text_view_cleanup(void);
+
+extern int UtcDaliAlignmentConstructorNegative(void);
+extern int UtcDaliAlignmentConstructorPositive(void);
+extern int UtcDaliAlignmentConstructorRegister(void);
+extern int UtcDaliAlignmentSetAlignmentTypePositiveOffStage(void);
+extern int UtcDaliAlignmentSetAlignmentTypePositiveOnStage(void);
+extern int UtcDaliAlignmentSetAlignmentTypeNegative(void);
+extern int UtcDaliAlignmentGetAlignmentType(void);
+extern int UtcDaliAlignmentSetScaling(void);
+extern int UtcDaliAlignmentGetScaling(void);
+extern int UtcDaliAlignmentSetPaddingPositive(void);
+extern int UtcDaliAlignmentSetPaddingNegative(void);
+extern int UtcDaliAlignmentGetPadding(void);
+extern int UtcDaliAlignmentChildAddAndRemove(void);
+extern int UtcDaliAlignmentOnSizeSet(void);
+extern int UtcDaliAlignmentOnTouchEvent(void);
+extern int UtcDaliAlignmentOnKeyEvent(void);
+extern int UtcDaliAlignmentOnSizeAnimation(void);
+extern int UtcDaliAlignmentCopyAndAssignment(void);
+extern int UtcDaliBubbleEmitterNew(void);
+extern int UtcDaliBubbleEmitterGetRootActor(void);
+extern int UtcDaliBubbleEmitterSetBackground(void);
+extern int UtcDaliBubbleEmitterSetShapeImage(void);
+extern int UtcDaliBubbleEmitterSetBubbleScale(void);
+extern int UtcDaliBubbleEmitterSetBubbleDensity01(void);
+extern int UtcDaliBubbleEmitterSetBubbleDensity02(void);
+extern int UtcDaliBubbleEmitterSetBlendMode(void);
+extern int UtcDaliBubbleEmitterEmitBubble(void);
+extern int UtcDaliBubbleEmitterStartExplosion(void);
+extern int UtcDaliBubbleEmitterRestore(void);
+extern int UtcDaliButtonNew(void);
+extern int UtcDaliButtonSetProperty(void);
+extern int UtcDaliButtonSetGetDimmed(void);
+extern int UtcDaliButtonSize(void);
+extern int UtcDaliButtonClicked(void);
+extern int UtcDaliButtonConnectSignal(void);
+extern int UtcDaliButtonSetGetAnimationTime(void);
+extern int UtcDaliControlConstructor(void);
+extern int UtcDaliControlNew(void);
+extern int UtcDaliControlRegister(void);
+extern int UtcDaliControlCopyAndAssignment(void);
+extern int UtcDaliControlDownCast(void);
+extern int UtcDaliControlDownCastTemplate(void);
+extern int UtcDaliControlKeyInputFocus(void);
+extern int UtcDaliControlGetImplementation(void);
+extern int UtcDaliControlSignalConnectDisconnect(void);
+extern int UtcDaliControlSignalAutomaticDisconnect(void);
+extern int UtcDaliControlTestParameters(void);
+extern int UtcDaliControlImplNew(void);
+extern int UtcDaliControlImplEnableGestureDetector(void);
+extern int UtcDaliControlImplDisableGestureDetector(void);
+extern int UtcDaliControlImplOnGestureMethods(void);
+extern int UtcDaliControlImplChildAddAndRemove(void);
+extern int UtcDaliControlImplStageConnection(void);
+extern int UtcDaliControlImplSizeSet(void);
+extern int UtcDaliControlImplSizeAnimation(void);
+extern int UtcDaliControlImplTouchEvent(void);
+extern int UtcDaliControlImplKeyEvent(void);
+extern int UtcDaliControlImplStyleChange(void);
+extern int UtcDaliControlImplKeyInputFocusGained(void);
+extern int UtcDaliControlImplKeyInputFocusLost(void);
+extern int UtcDaliDefaultControlsCreateSolidColorActor(void);
+extern int UtcDaliDefaultControlsCreatePushButton(void);
+extern int UtcDaliDissolveUninitializedEffect(void);
+extern int UtcDaliDissolvePropertyNamesEffect(void);
+extern int UtcDaliDissolveDefaultValuesEffect(void);
+extern int UtcDaliDissolveCustomValuesEffect(void);
+extern int UtcDaliSetEffectImageEffect(void);
+extern int UtcDaliFocusManagerGet(void);
+extern int UtcDaliFocusManagerSetAndGetAccessibilityAttribute(void);
+extern int UtcDaliFocusManagerSetAndGetFocusOrder(void);
+extern int UtcDaliFocusManagerGenerateNewFocusOrder(void);
+extern int UtcDaliFocusManagerGetActorByFocusOrder(void);
+extern int UtcDaliFocusManagerSetAndGetCurrentFocusActor(void);
+extern int UtcDaliFocusManagerGetCurrentFocusGroup(void);
+extern int UtcDaliFocusManagerGetCurrentFocusOrder(void);
+extern int UtcDaliFocusManagerMoveFocusForward(void);
+extern int UtcDaliFocusManagerMoveFocusBackward(void);
+extern int UtcDaliFocusManagerClearFocus(void);
+extern int UtcDaliFocusManagerReset(void);
+extern int UtcDaliFocusManagerFocusGroup(void);
+extern int UtcDaliFocusManagerSetAndGetFocusIndicator(void);
+extern int UtcDaliFocusManagerSignalFocusChanged(void);
+extern int UtcDaliFocusManagerSignalFocusOvershot(void);
+extern int UtcDaliGridLayoutNew(void);
+extern int UtcDaliGridLayoutSetAndGetNumberOfColumns(void);
+extern int UtcDaliGridLayoutSetAndGetRowSpacing(void);
+extern int UtcDaliGridLayoutSetAndGetColumnSpacing(void);
+extern int UtcDaliGridLayoutSetAndGetTopMargin(void);
+extern int UtcDaliGridLayoutSetAndGetBottomMargin(void);
+extern int UtcDaliGridLayoutSetAndGetSideMargin(void);
+extern int UtcDaliGridLayoutSetAndGetZGap(void);
+extern int UtcDaliGridLayoutSetAndGetItemSizeFunction(void);
+extern int UtcDaliGridLayoutSetAndGetScrollSpeedFactor(void);
+extern int UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed(void);
+extern int UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration(void);
+extern int UtcDaliGridLayoutConstraintLeft(void);
+extern int UtcDaliGridLayoutConstraintRight(void);
+extern int UtcDaliGridLayoutConstraintUp(void);
+extern int UtcDaliGridLayoutConstraintDown(void);
+extern int UtcDaliGridLayoutScrollDirection(void);
+extern int UtcDaliIrisEffectUninitialized(void);
+extern int UtcDaliIrisEffectPropertyNames(void);
+extern int UtcDaliIrisEffectDefaultValues(void);
+extern int UtcDaliIrisEffectCustomValues(void);
+extern int UtcDaliItemLayoutSetAndGetOrientation(void);
+extern int UtcDaliItemLayoutGetScrollHints(void);
+extern int UtcDaliItemViewNew(void);
+extern int UtcDaliItemViewDownCast(void);
+extern int UtcDaliItemViewAddAndGetLayout(void);
+extern int UtcDaliItemViewAddAndRemoveLayout(void);
+extern int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void);
+extern int UtcDaliItemViewDeactivateCurrentLayout(void);
+extern int UtcDaliItemViewGetItemAndGetItemId(void);
+extern int UtcDaliItemViewRemoveItem(void);
+extern int UtcDaliItemViewGetCurrentLayoutPosition(void);
+extern int UtcDaliItemViewSetAndGetMinimumSwipeSpeed(void);
+extern int UtcDaliItemViewSetAndGetMinimumSwipeDistance(void);
+extern int UtcDaliItemViewSetAndGetAnchoring(void);
+extern int UtcDaliItemViewSetAndGetAnchoringDuration(void);
+extern int UtcDaliItemViewSetAndGetRefreshInterval(void);
+extern int UtcDaliItemViewScrollToItem(void);
+extern int UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep(void);
+extern int UtcDaliKeyboardFocusManagerGet(void);
+extern int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor(void);
+extern int UtcDaliKeyboardFocusManagerMoveFocus(void);
+extern int UtcDaliKeyboardFocusManagerClearFocus(void);
+extern int UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop(void);
+extern int UtcDaliKeyboardFocusManagerSetAsFocusGroup(void);
+extern int UtcDaliKeyboardFocusManagerGetFocusGroup(void);
+extern int UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator(void);
+extern int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void);
+extern int UtcDaliMarkupProcessor(void);
+extern int UtcDaliMarkupProcessorSetTextStyle01(void);
+extern int UtcDaliMarkupProcessorSetTextStyle02(void);
+extern int UtcDaliMarkupProcessorTestColors(void);
+extern int UtcDaliMaskEffectCreateEffect(void);
+extern int UtcDaliMaskEffectDestructor(void);
+extern int UtcDaliNinePatchMaskEffectApply(void);
+extern int UtcDaliPopupNew(void);
+extern int UtcDaliPopupDestructor(void);
+extern int UtcDaliPopupDownCast(void);
+extern int UtcDaliPopoupSetProperty(void);
+extern int UtcDaliPopupSetBackgroundImage(void);
+extern int UtcDaliPopupSetTitle(void);
+extern int UtcDaliPopupSetTitleText(void);
+extern int UtcDaliPopupAddButton(void);
+extern int UtcDaliPopupSetState(void);
+extern int UtcDaliPopupSetStateSlow(void);
+extern int UtcDaliPopupShowHide(void);
+extern int UtcDaliPopupShowHideTail(void);
+extern int UtcDaliPopupOnTouchedOutside(void);
+extern int UtcDaliPushButtonSetGetAutoRepeating(void);
+extern int UtcDaliPushButtonSetGetToggleButton(void);
+extern int UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton(void);
+extern int UtcDaliPushButtonSetGetToggled01(void);
+extern int UtcDaliPushButtonSetGetToggled02(void);
+extern int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void);
+extern int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void);
+extern int UtcDaliPushButtonSetImages(void);
+extern int UtcDaliPushButtonSetLabelText(void);
+extern int UtcDaliPushButtonPressed(void);
+extern int UtcDaliPushButtonReleased(void);
+extern int UtcDaliPushButtonToggled(void);
+extern int UtcDaliRipple2DEffectUninitialized(void);
+extern int UtcDaliRipple2DEffectPropertyNames(void);
+extern int UtcDaliRipple2DEffectDefaultValues(void);
+extern int UtcDaliRipple2DEffectCustomValues(void);
+extern int UtcDaliRippleUninitializedEffect(void);
+extern int UtcDaliRipplePropertyNamesEffect(void);
+extern int UtcDaliRippleDefaultValuesEffect(void);
+extern int UtcDaliRippleCustomValuesEffect(void);
+extern int UtcDaliScrollViewCustomEffectSetup(void);
+extern int UtcDaliScrollViewCubeEffectSetup(void);
+extern int UtcDaliScrollViewSpiralEffectSetup(void);
+extern int UtcDaliScrollViewSlideEffectSetup(void);
+extern int UtcDaliScrollViewTwistEffectSetup(void);
+extern int UtcDaliScrollViewCubeEffectTest(void);
+extern int UtcDaliScrollViewSpiralEffectTest(void);
+extern int UtcDaliScrollViewSlideEffectTest(void);
+extern int UtcDaliScrollViewTwistEffectTest(void);
+extern int UtcDaliScrollViewCustomEffectTest(void);
+extern int UtcDaliSuperBlurViewNew(void);
+extern int UtcDaliSuperBlurViewSetImage(void);
+extern int UtcDaliSuperBlurViewSetGetBlurStrength(void);
+extern int UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex(void);
+extern int UtcDaliSuperBlurViewGetBlurredImage(void);
+extern int UtcDaliSwirlUninitializedEffect(void);
+extern int UtcDaliSwirlPropertyNamesEffect(void);
+extern int UtcDaliSwirlDefaultValuesEffect(void);
+extern int UtcDaliSwirlCustomValuesEffect(void);
+extern int UtcDaliTextInputConstruction(void);
+extern int UtcDaliTextInputDownCast(void);
+extern int UtcDaliTextInputGetText(void);
+extern int UtcDaliTextInputGetMarkupText(void);
+extern int UtcDaliTextInputSetMaxCharacterLength(void);
+extern int UtcDaliTextInputSetAndGetNumberOfLines(void);
+extern int UtcDaliTextInputGetNumberOfCharacters(void);
+extern int UtcDaliTextInputSetAndGetPlaceholderText(void);
+extern int UtcDaliTextInputSetInitialText(void);
+extern int UtcDaliTextInputSetEditableAndIsEditable(void);
+extern int UtcDaliTextInputSetEditOnTouch(void);
+extern int UtcDaliTextInputSetTextSelectable(void);
+extern int UtcDaliTextInputTextSelection(void);
+extern int UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled(void);
+extern int UtcDaliTextInputSetAndGetBoundingRectangle(void);
+extern int UtcDaliTextInputSetAndGetTextAlignment(void);
+extern int UtcDaliTextInputSetSortModifier(void);
+extern int UtcDaliTextInputSetAndGetSnapshotModeEnabled(void);
+extern int UtcDaliTextInputEndSignalEmit(void);
+extern int UtcDaliTextInputStartSignalEmit(void);
+extern int UtcDaliTextInputExceedMaxCharacters(void);
+extern int UtcDaliTextInputSetAndGetFadeBoundary(void);
+extern int UtcDaliTextInputSetAndGetWidthExceedPolicy(void);
+extern int UtcDaliTextInputSetAndGetHeightExceedPolicy(void);
+extern int UtcDaliTextInputScroll(void);
+extern int UtcDaliTextViewNew(void);
+extern int UtcDaliTextViewSetAndGetText(void);
+extern int UtcDaliTextViewSetStyleToCurrentText(void);
+extern int UtcDaliTextViewSetAndGetLineHeight(void);
+extern int UtcDaliTextViewSetAndGetFadeBoundary(void);
+extern int UtcDaliTextViewSetAndGetEllipsizeText(void);
+extern int UtcDaliTextViewSetAndGetWidthExceedPolicy(void);
+extern int UtcDaliTextViewSetAndGetHeightExceedPolicy(void);
+extern int UtcDaliTextViewTestLayoutOptions01(void);
+extern int UtcDaliTextViewTestLayoutOptions02(void);
+extern int UtcDaliTextViewInsertRemoveText(void);
+extern int UtcDaliTextViewSnapshotEnable(void);
+extern int UtcDaliTextViewScroll(void);
+extern int UtcDaliTextViewSetProperty(void);
+extern int UtcDaliTextViewSetSortModifier(void);
+extern int UtcDaliTextViewUnderlineText(void);
+
+testcase tc_array[] = {
+ {"UtcDaliAlignmentConstructorNegative", UtcDaliAlignmentConstructorNegative, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentConstructorPositive", UtcDaliAlignmentConstructorPositive, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentConstructorRegister", UtcDaliAlignmentConstructorRegister, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentSetAlignmentTypePositiveOffStage", UtcDaliAlignmentSetAlignmentTypePositiveOffStage, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentSetAlignmentTypePositiveOnStage", UtcDaliAlignmentSetAlignmentTypePositiveOnStage, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentSetAlignmentTypeNegative", UtcDaliAlignmentSetAlignmentTypeNegative, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentGetAlignmentType", UtcDaliAlignmentGetAlignmentType, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentSetScaling", UtcDaliAlignmentSetScaling, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentGetScaling", UtcDaliAlignmentGetScaling, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentSetPaddingPositive", UtcDaliAlignmentSetPaddingPositive, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentSetPaddingNegative", UtcDaliAlignmentSetPaddingNegative, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentGetPadding", UtcDaliAlignmentGetPadding, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentChildAddAndRemove", UtcDaliAlignmentChildAddAndRemove, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentOnSizeSet", UtcDaliAlignmentOnSizeSet, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentOnTouchEvent", UtcDaliAlignmentOnTouchEvent, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentOnKeyEvent", UtcDaliAlignmentOnKeyEvent, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentOnSizeAnimation", UtcDaliAlignmentOnSizeAnimation, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliAlignmentCopyAndAssignment", UtcDaliAlignmentCopyAndAssignment, utc_dali_toolkit_alignment_startup, utc_dali_toolkit_alignment_cleanup},
+ {"UtcDaliBubbleEmitterNew", UtcDaliBubbleEmitterNew, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterGetRootActor", UtcDaliBubbleEmitterGetRootActor, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterSetBackground", UtcDaliBubbleEmitterSetBackground, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterSetShapeImage", UtcDaliBubbleEmitterSetShapeImage, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterSetBubbleScale", UtcDaliBubbleEmitterSetBubbleScale, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterSetBubbleDensity01", UtcDaliBubbleEmitterSetBubbleDensity01, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterSetBubbleDensity02", UtcDaliBubbleEmitterSetBubbleDensity02, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterSetBlendMode", UtcDaliBubbleEmitterSetBlendMode, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterEmitBubble", UtcDaliBubbleEmitterEmitBubble, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterStartExplosion", UtcDaliBubbleEmitterStartExplosion, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliBubbleEmitterRestore", UtcDaliBubbleEmitterRestore, utc_dali_toolkit_bubble_emitter_startup, utc_dali_toolkit_bubble_emitter_cleanup},
+ {"UtcDaliButtonNew", UtcDaliButtonNew, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup},
+ {"UtcDaliButtonSetProperty", UtcDaliButtonSetProperty, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup},
+ {"UtcDaliButtonSetGetDimmed", UtcDaliButtonSetGetDimmed, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup},
+ {"UtcDaliButtonSize", UtcDaliButtonSize, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup},
+ {"UtcDaliButtonClicked", UtcDaliButtonClicked, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup},
+ {"UtcDaliButtonConnectSignal", UtcDaliButtonConnectSignal, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup},
+ {"UtcDaliButtonSetGetAnimationTime", UtcDaliButtonSetGetAnimationTime, utc_dali_toolkit_button_startup, utc_dali_toolkit_button_cleanup},
+ {"UtcDaliControlConstructor", UtcDaliControlConstructor, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlNew", UtcDaliControlNew, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlRegister", UtcDaliControlRegister, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlCopyAndAssignment", UtcDaliControlCopyAndAssignment, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlDownCast", UtcDaliControlDownCast, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlDownCastTemplate", UtcDaliControlDownCastTemplate, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlKeyInputFocus", UtcDaliControlKeyInputFocus, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlGetImplementation", UtcDaliControlGetImplementation, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlSignalConnectDisconnect", UtcDaliControlSignalConnectDisconnect, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlSignalAutomaticDisconnect", UtcDaliControlSignalAutomaticDisconnect, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlTestParameters", UtcDaliControlTestParameters, utc_dali_toolkit_control_startup, utc_dali_toolkit_control_cleanup},
+ {"UtcDaliControlImplNew", UtcDaliControlImplNew, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplEnableGestureDetector", UtcDaliControlImplEnableGestureDetector, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplDisableGestureDetector", UtcDaliControlImplDisableGestureDetector, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplOnGestureMethods", UtcDaliControlImplOnGestureMethods, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplChildAddAndRemove", UtcDaliControlImplChildAddAndRemove, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplStageConnection", UtcDaliControlImplStageConnection, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplSizeSet", UtcDaliControlImplSizeSet, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplSizeAnimation", UtcDaliControlImplSizeAnimation, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplTouchEvent", UtcDaliControlImplTouchEvent, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplKeyEvent", UtcDaliControlImplKeyEvent, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplStyleChange", UtcDaliControlImplStyleChange, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplKeyInputFocusGained", UtcDaliControlImplKeyInputFocusGained, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliControlImplKeyInputFocusLost", UtcDaliControlImplKeyInputFocusLost, utc_dali_toolkit_control_impl_startup, utc_dali_toolkit_control_impl_cleanup},
+ {"UtcDaliDefaultControlsCreateSolidColorActor", UtcDaliDefaultControlsCreateSolidColorActor, utc_dali_toolkit_default_controls_startup, utc_dali_toolkit_default_controls_cleanup},
+ {"UtcDaliDefaultControlsCreatePushButton", UtcDaliDefaultControlsCreatePushButton, utc_dali_toolkit_default_controls_startup, utc_dali_toolkit_default_controls_cleanup},
+ {"UtcDaliDissolveUninitializedEffect", UtcDaliDissolveUninitializedEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup},
+ {"UtcDaliDissolvePropertyNamesEffect", UtcDaliDissolvePropertyNamesEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup},
+ {"UtcDaliDissolveDefaultValuesEffect", UtcDaliDissolveDefaultValuesEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup},
+ {"UtcDaliDissolveCustomValuesEffect", UtcDaliDissolveCustomValuesEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup},
+ {"UtcDaliSetEffectImageEffect", UtcDaliSetEffectImageEffect, utc_dali_toolkit_dissolve_effect_startup, utc_dali_toolkit_dissolve_effect_cleanup},
+ {"UtcDaliFocusManagerGet", UtcDaliFocusManagerGet, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerSetAndGetAccessibilityAttribute", UtcDaliFocusManagerSetAndGetAccessibilityAttribute, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerSetAndGetFocusOrder", UtcDaliFocusManagerSetAndGetFocusOrder, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerGenerateNewFocusOrder", UtcDaliFocusManagerGenerateNewFocusOrder, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerGetActorByFocusOrder", UtcDaliFocusManagerGetActorByFocusOrder, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerSetAndGetCurrentFocusActor", UtcDaliFocusManagerSetAndGetCurrentFocusActor, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerGetCurrentFocusGroup", UtcDaliFocusManagerGetCurrentFocusGroup, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerGetCurrentFocusOrder", UtcDaliFocusManagerGetCurrentFocusOrder, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerMoveFocusForward", UtcDaliFocusManagerMoveFocusForward, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerMoveFocusBackward", UtcDaliFocusManagerMoveFocusBackward, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerClearFocus", UtcDaliFocusManagerClearFocus, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerReset", UtcDaliFocusManagerReset, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerFocusGroup", UtcDaliFocusManagerFocusGroup, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerSetAndGetFocusIndicator", UtcDaliFocusManagerSetAndGetFocusIndicator, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerSignalFocusChanged", UtcDaliFocusManagerSignalFocusChanged, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliFocusManagerSignalFocusOvershot", UtcDaliFocusManagerSignalFocusOvershot, utc_dali_toolkit_focus_manager_startup, utc_dali_toolkit_focus_manager_cleanup},
+ {"UtcDaliGridLayoutNew", UtcDaliGridLayoutNew, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetNumberOfColumns", UtcDaliGridLayoutSetAndGetNumberOfColumns, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetRowSpacing", UtcDaliGridLayoutSetAndGetRowSpacing, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetColumnSpacing", UtcDaliGridLayoutSetAndGetColumnSpacing, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetTopMargin", UtcDaliGridLayoutSetAndGetTopMargin, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetBottomMargin", UtcDaliGridLayoutSetAndGetBottomMargin, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetSideMargin", UtcDaliGridLayoutSetAndGetSideMargin, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetZGap", UtcDaliGridLayoutSetAndGetZGap, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetItemSizeFunction", UtcDaliGridLayoutSetAndGetItemSizeFunction, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetScrollSpeedFactor", UtcDaliGridLayoutSetAndGetScrollSpeedFactor, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed", UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration", UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutConstraintLeft", UtcDaliGridLayoutConstraintLeft, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutConstraintRight", UtcDaliGridLayoutConstraintRight, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutConstraintUp", UtcDaliGridLayoutConstraintUp, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutConstraintDown", UtcDaliGridLayoutConstraintDown, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliGridLayoutScrollDirection", UtcDaliGridLayoutScrollDirection, utc_dali_toolkit_grid_layout_startup, utc_dali_toolkit_grid_layout_cleanup},
+ {"UtcDaliIrisEffectUninitialized", UtcDaliIrisEffectUninitialized, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup},
+ {"UtcDaliIrisEffectPropertyNames", UtcDaliIrisEffectPropertyNames, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup},
+ {"UtcDaliIrisEffectDefaultValues", UtcDaliIrisEffectDefaultValues, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup},
+ {"UtcDaliIrisEffectCustomValues", UtcDaliIrisEffectCustomValues, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup},
+ {"UtcDaliItemLayoutSetAndGetOrientation", UtcDaliItemLayoutSetAndGetOrientation, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup},
+ {"UtcDaliItemLayoutGetScrollHints", UtcDaliItemLayoutGetScrollHints, utc_dali_toolkit_iris_effect_startup, utc_dali_toolkit_iris_effect_cleanup},
+ {"UtcDaliItemViewNew", UtcDaliItemViewNew, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewDownCast", UtcDaliItemViewDownCast, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewAddAndGetLayout", UtcDaliItemViewAddAndGetLayout, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewAddAndRemoveLayout", UtcDaliItemViewAddAndRemoveLayout, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewActivateLayoutAndGetActiveLayout", UtcDaliItemViewActivateLayoutAndGetActiveLayout, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewDeactivateCurrentLayout", UtcDaliItemViewDeactivateCurrentLayout, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewGetItemAndGetItemId", UtcDaliItemViewGetItemAndGetItemId, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewRemoveItem", UtcDaliItemViewRemoveItem, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewGetCurrentLayoutPosition", UtcDaliItemViewGetCurrentLayoutPosition, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewSetAndGetMinimumSwipeSpeed", UtcDaliItemViewSetAndGetMinimumSwipeSpeed, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewSetAndGetMinimumSwipeDistance", UtcDaliItemViewSetAndGetMinimumSwipeDistance, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewSetAndGetAnchoring", UtcDaliItemViewSetAndGetAnchoring, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewSetAndGetAnchoringDuration", UtcDaliItemViewSetAndGetAnchoringDuration, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewSetAndGetRefreshInterval", UtcDaliItemViewSetAndGetRefreshInterval, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewScrollToItem", UtcDaliItemViewScrollToItem, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep", UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep, utc_dali_toolkit_item_view_startup, utc_dali_toolkit_item_view_cleanup},
+ {"UtcDaliKeyboardFocusManagerGet", UtcDaliKeyboardFocusManagerGet, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor", UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerMoveFocus", UtcDaliKeyboardFocusManagerMoveFocus, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerClearFocus", UtcDaliKeyboardFocusManagerClearFocus, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop", UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerSetAsFocusGroup", UtcDaliKeyboardFocusManagerSetAsFocusGroup, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerGetFocusGroup", UtcDaliKeyboardFocusManagerGetFocusGroup, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator", UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliKeyboardFocusManagerSignalFocusedActorActivated", UtcDaliKeyboardFocusManagerSignalFocusedActorActivated, utc_dali_toolkit_keyboard_focus_manager_startup, utc_dali_toolkit_keyboard_focus_manager_cleanup},
+ {"UtcDaliMarkupProcessor", UtcDaliMarkupProcessor, utc_dali_toolkit_markup_processor_startup, utc_dali_toolkit_markup_processor_cleanup},
+ {"UtcDaliMarkupProcessorSetTextStyle01", UtcDaliMarkupProcessorSetTextStyle01, utc_dali_toolkit_markup_processor_startup, utc_dali_toolkit_markup_processor_cleanup},
+ {"UtcDaliMarkupProcessorSetTextStyle02", UtcDaliMarkupProcessorSetTextStyle02, utc_dali_toolkit_markup_processor_startup, utc_dali_toolkit_markup_processor_cleanup},
+ {"UtcDaliMarkupProcessorTestColors", UtcDaliMarkupProcessorTestColors, utc_dali_toolkit_markup_processor_startup, utc_dali_toolkit_markup_processor_cleanup},
+ {"UtcDaliMaskEffectCreateEffect", UtcDaliMaskEffectCreateEffect, utc_dali_toolkit_mask_effect_startup, utc_dali_toolkit_mask_effect_cleanup},
+ {"UtcDaliMaskEffectDestructor", UtcDaliMaskEffectDestructor, utc_dali_toolkit_mask_effect_startup, utc_dali_toolkit_mask_effect_cleanup},
+ {"UtcDaliNinePatchMaskEffectApply", UtcDaliNinePatchMaskEffectApply, utc_dali_toolkit_nine_patch_startup, utc_dali_toolkit_nine_patch_cleanup},
+ {"UtcDaliPopupNew", UtcDaliPopupNew, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupDestructor", UtcDaliPopupDestructor, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupDownCast", UtcDaliPopupDownCast, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopoupSetProperty", UtcDaliPopoupSetProperty, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupSetBackgroundImage", UtcDaliPopupSetBackgroundImage, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupSetTitle", UtcDaliPopupSetTitle, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupSetTitleText", UtcDaliPopupSetTitleText, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupAddButton", UtcDaliPopupAddButton, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupSetState", UtcDaliPopupSetState, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupSetStateSlow", UtcDaliPopupSetStateSlow, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupShowHide", UtcDaliPopupShowHide, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupShowHideTail", UtcDaliPopupShowHideTail, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPopupOnTouchedOutside", UtcDaliPopupOnTouchedOutside, utc_dali_toolkit_popup_startup, utc_dali_toolkit_popup_cleanup},
+ {"UtcDaliPushButtonSetGetAutoRepeating", UtcDaliPushButtonSetGetAutoRepeating, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonSetGetToggleButton", UtcDaliPushButtonSetGetToggleButton, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton", UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonSetGetToggled01", UtcDaliPushButtonSetGetToggled01, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonSetGetToggled02", UtcDaliPushButtonSetGetToggled02, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonSetGetAutorepeatingDelayValues01", UtcDaliPushButtonSetGetAutorepeatingDelayValues01, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonSetGetAutorepeatingDelayValues02", UtcDaliPushButtonSetGetAutorepeatingDelayValues02, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonSetImages", UtcDaliPushButtonSetImages, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonSetLabelText", UtcDaliPushButtonSetLabelText, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonPressed", UtcDaliPushButtonPressed, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonReleased", UtcDaliPushButtonReleased, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliPushButtonToggled", UtcDaliPushButtonToggled, utc_dali_toolkit_pushbutton_startup, utc_dali_toolkit_pushbutton_cleanup},
+ {"UtcDaliRipple2DEffectUninitialized", UtcDaliRipple2DEffectUninitialized, utc_dali_toolkit_ripple_2d_effect_startup, utc_dali_toolkit_ripple_2d_effect_cleanup},
+ {"UtcDaliRipple2DEffectPropertyNames", UtcDaliRipple2DEffectPropertyNames, utc_dali_toolkit_ripple_2d_effect_startup, utc_dali_toolkit_ripple_2d_effect_cleanup},
+ {"UtcDaliRipple2DEffectDefaultValues", UtcDaliRipple2DEffectDefaultValues, utc_dali_toolkit_ripple_2d_effect_startup, utc_dali_toolkit_ripple_2d_effect_cleanup},
+ {"UtcDaliRipple2DEffectCustomValues", UtcDaliRipple2DEffectCustomValues, utc_dali_toolkit_ripple_2d_effect_startup, utc_dali_toolkit_ripple_2d_effect_cleanup},
+ {"UtcDaliRippleUninitializedEffect", UtcDaliRippleUninitializedEffect, utc_dali_toolkit_ripple_effect_startup, utc_dali_toolkit_ripple_effect_cleanup},
+ {"UtcDaliRipplePropertyNamesEffect", UtcDaliRipplePropertyNamesEffect, utc_dali_toolkit_ripple_effect_startup, utc_dali_toolkit_ripple_effect_cleanup},
+ {"UtcDaliRippleDefaultValuesEffect", UtcDaliRippleDefaultValuesEffect, utc_dali_toolkit_ripple_effect_startup, utc_dali_toolkit_ripple_effect_cleanup},
+ {"UtcDaliRippleCustomValuesEffect", UtcDaliRippleCustomValuesEffect, utc_dali_toolkit_ripple_effect_startup, utc_dali_toolkit_ripple_effect_cleanup},
+ {"UtcDaliScrollViewCustomEffectSetup", UtcDaliScrollViewCustomEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewCubeEffectSetup", UtcDaliScrollViewCubeEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewSpiralEffectSetup", UtcDaliScrollViewSpiralEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewSlideEffectSetup", UtcDaliScrollViewSlideEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewTwistEffectSetup", UtcDaliScrollViewTwistEffectSetup, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewCubeEffectTest", UtcDaliScrollViewCubeEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewSpiralEffectTest", UtcDaliScrollViewSpiralEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewSlideEffectTest", UtcDaliScrollViewSlideEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewTwistEffectTest", UtcDaliScrollViewTwistEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliScrollViewCustomEffectTest", UtcDaliScrollViewCustomEffectTest, utc_dali_toolkit_scroll_view_effect_startup, utc_dali_toolkit_scroll_view_effect_cleanup},
+ {"UtcDaliSuperBlurViewNew", UtcDaliSuperBlurViewNew, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup},
+ {"UtcDaliSuperBlurViewSetImage", UtcDaliSuperBlurViewSetImage, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup},
+ {"UtcDaliSuperBlurViewSetGetBlurStrength", UtcDaliSuperBlurViewSetGetBlurStrength, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup},
+ {"UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex", UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup},
+ {"UtcDaliSuperBlurViewGetBlurredImage", UtcDaliSuperBlurViewGetBlurredImage, utc_dali_toolkit_super_blur_view_startup, utc_dali_toolkit_super_blur_view_cleanup},
+ {"UtcDaliSwirlUninitializedEffect", UtcDaliSwirlUninitializedEffect, utc_dali_toolkit_swirl_effect_startup, utc_dali_toolkit_swirl_effect_cleanup},
+ {"UtcDaliSwirlPropertyNamesEffect", UtcDaliSwirlPropertyNamesEffect, utc_dali_toolkit_swirl_effect_startup, utc_dali_toolkit_swirl_effect_cleanup},
+ {"UtcDaliSwirlDefaultValuesEffect", UtcDaliSwirlDefaultValuesEffect, utc_dali_toolkit_swirl_effect_startup, utc_dali_toolkit_swirl_effect_cleanup},
+ {"UtcDaliSwirlCustomValuesEffect", UtcDaliSwirlCustomValuesEffect, utc_dali_toolkit_swirl_effect_startup, utc_dali_toolkit_swirl_effect_cleanup},
+ {"UtcDaliTextInputConstruction", UtcDaliTextInputConstruction, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputDownCast", UtcDaliTextInputDownCast, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputGetText", UtcDaliTextInputGetText, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputGetMarkupText", UtcDaliTextInputGetMarkupText, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetMaxCharacterLength", UtcDaliTextInputSetMaxCharacterLength, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetAndGetNumberOfLines", UtcDaliTextInputSetAndGetNumberOfLines, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputGetNumberOfCharacters", UtcDaliTextInputGetNumberOfCharacters, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetAndGetPlaceholderText", UtcDaliTextInputSetAndGetPlaceholderText, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetInitialText", UtcDaliTextInputSetInitialText, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetEditableAndIsEditable", UtcDaliTextInputSetEditableAndIsEditable, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetEditOnTouch", UtcDaliTextInputSetEditOnTouch, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetTextSelectable", UtcDaliTextInputSetTextSelectable, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputTextSelection", UtcDaliTextInputTextSelection, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled", UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetAndGetBoundingRectangle", UtcDaliTextInputSetAndGetBoundingRectangle, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetAndGetTextAlignment", UtcDaliTextInputSetAndGetTextAlignment, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetSortModifier", UtcDaliTextInputSetSortModifier, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetAndGetSnapshotModeEnabled", UtcDaliTextInputSetAndGetSnapshotModeEnabled, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputEndSignalEmit", UtcDaliTextInputEndSignalEmit, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputStartSignalEmit", UtcDaliTextInputStartSignalEmit, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputExceedMaxCharacters", UtcDaliTextInputExceedMaxCharacters, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetAndGetFadeBoundary", UtcDaliTextInputSetAndGetFadeBoundary, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetAndGetWidthExceedPolicy", UtcDaliTextInputSetAndGetWidthExceedPolicy, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputSetAndGetHeightExceedPolicy", UtcDaliTextInputSetAndGetHeightExceedPolicy, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextInputScroll", UtcDaliTextInputScroll, utc_dali_toolkit_text_input_startup, utc_dali_toolkit_text_input_cleanup},
+ {"UtcDaliTextViewNew", UtcDaliTextViewNew, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetAndGetText", UtcDaliTextViewSetAndGetText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetStyleToCurrentText", UtcDaliTextViewSetStyleToCurrentText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetAndGetLineHeight", UtcDaliTextViewSetAndGetLineHeight, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetAndGetFadeBoundary", UtcDaliTextViewSetAndGetFadeBoundary, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetAndGetEllipsizeText", UtcDaliTextViewSetAndGetEllipsizeText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetAndGetWidthExceedPolicy", UtcDaliTextViewSetAndGetWidthExceedPolicy, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetAndGetHeightExceedPolicy", UtcDaliTextViewSetAndGetHeightExceedPolicy, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewTestLayoutOptions01", UtcDaliTextViewTestLayoutOptions01, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewTestLayoutOptions02", UtcDaliTextViewTestLayoutOptions02, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewInsertRemoveText", UtcDaliTextViewInsertRemoveText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSnapshotEnable", UtcDaliTextViewSnapshotEnable, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewScroll", UtcDaliTextViewScroll, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetProperty", UtcDaliTextViewSetProperty, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewSetSortModifier", UtcDaliTextViewSetSortModifier, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {"UtcDaliTextViewUnderlineText", UtcDaliTextViewUnderlineText, utc_dali_toolkit_text_view_startup, utc_dali_toolkit_text_view_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_DALI_TOOLKIT_CORE_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void utc_dali_toolkit_alignment_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_alignment_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+} // namespace
+
+
+int UtcDaliAlignmentConstructorNegative(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment;
+
+ try
+ {
+ Alignment::Padding padding;
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "alignment")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ END_TEST;
+}
+
+int UtcDaliAlignmentConstructorPositive(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+
+ try
+ {
+ Alignment::Padding padding;
+ alignment.SetPadding(padding);
+ tet_result(TET_PASS);
+ }
+ catch (DaliException& exception)
+ {
+ tet_result(TET_FAIL);
+ }
+
+ Actor actor = alignment;
+ alignment = Alignment::DownCast( actor );
+
+ DALI_TEST_CHECK( alignment );
+ END_TEST;
+}
+
+int UtcDaliAlignmentConstructorRegister(void)
+{
+ ToolkitTestApplication application;
+
+ //Te ensure the object is registered after creation
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ Alignment alignment = Alignment::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliAlignmentSetAlignmentTypePositiveOffStage(void)
+{
+ ToolkitTestApplication application;
+
+ // Default, HorizontalCenter, VerticalCenter - Ensure they do not change!
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::VerticalCenter));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalLeft, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::HorizontalLeft);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalRight, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::HorizontalRight);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalLeft, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalTop));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalCenter, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::VerticalTop);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalRight, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalTop));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalLeft, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalBottom));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalCenter, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::VerticalBottom);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalRight, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalBottom));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+ END_TEST;
+}
+
+int UtcDaliAlignmentSetAlignmentTypePositiveOnStage(void)
+{
+ ToolkitTestApplication application;
+
+ // Default, HorizontalCenter, VerticalCenter - Ensure they do not change!
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::VerticalCenter));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::HorizontalLeft);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::HorizontalRight);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalTop));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalCenter, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::VerticalTop);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalTop));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalBottom));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalCenter, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::VerticalBottom);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalBottom));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+ END_TEST;
+}
+
+int UtcDaliAlignmentSetAlignmentTypeNegative(void)
+{
+ ToolkitTestApplication application;
+
+ // Setting HorizontalLeft, HorizontalCenter
+ {
+ Alignment alignment = Alignment::New();
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::HorizontalCenter));
+
+ try
+ {
+ alignment.SetAlignmentType(type);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "!horizontalSet")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ }
+
+ // Setting HorizontalCenter, HorizontalRight
+ {
+ Alignment alignment = Alignment::New();
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::HorizontalRight));
+
+ try
+ {
+ alignment.SetAlignmentType(type);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "!horizontalSet")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ }
+
+ // Setting VerticalTop, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+ Alignment::Type type(Alignment::Type(Alignment::VerticalTop | Alignment::VerticalCenter));
+
+ try
+ {
+ alignment.SetAlignmentType(type);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "!verticalSet")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ }
+
+ // Setting VerticalCenter, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+ Alignment::Type type(Alignment::Type(Alignment::VerticalTop | Alignment::VerticalBottom));
+
+ try
+ {
+ alignment.SetAlignmentType(type);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "!veritcalSet")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ }
+ END_TEST;
+}
+
+int UtcDaliAlignmentGetAlignmentType(void)
+{
+ ToolkitTestApplication application;
+
+ // Default, HorizonalCenter, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalCenter
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalLeft);
+ DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalCenter
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalRight);
+ DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalTop
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalLeft, Alignment::VerticalTop);
+ DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalCenter, VerticalTop
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalCenter, Alignment::VerticalTop);
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalTop
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalRight, Alignment::VerticalTop);
+ DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalBottom
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalLeft, Alignment::VerticalBottom);
+ DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalCenter, VerticalBottom
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalCenter, Alignment::VerticalBottom);
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalBottom
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalRight, Alignment::VerticalBottom);
+ DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+ END_TEST;
+}
+
+int UtcDaliAlignmentSetScaling(void)
+{
+ ToolkitTestApplication application;
+
+ // ScaleToFill
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ScaleToFill);
+ DALI_TEST_EQUALS(Alignment::ScaleToFill, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // ScaleToFitKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ScaleToFitKeepAspect);
+ DALI_TEST_EQUALS(Alignment::ScaleToFitKeepAspect, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // ScaleToFillKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ScaleToFillKeepAspect);
+ DALI_TEST_EQUALS(Alignment::ScaleToFillKeepAspect, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // ShrinkToFit
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ShrinkToFit);
+ DALI_TEST_EQUALS(Alignment::ShrinkToFit, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // ShrinkToFitKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ShrinkToFitKeepAspect);
+ DALI_TEST_EQUALS(Alignment::ShrinkToFitKeepAspect, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+ END_TEST;
+}
+
+int UtcDaliAlignmentGetScaling(void)
+{
+ ToolkitTestApplication application;
+
+ // ScaleToFill
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ScaleToFill);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFill);
+ }
+
+ // ScaleToFitKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ScaleToFitKeepAspect);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFitKeepAspect);
+ }
+
+ // ScaleToFillKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ScaleToFillKeepAspect);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFillKeepAspect);
+ }
+
+ // ShrinkToFit
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ShrinkToFit);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ShrinkToFit);
+ }
+
+ // ShrinkToFitKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ShrinkToFitKeepAspect);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ShrinkToFitKeepAspect);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliAlignmentSetPaddingPositive(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+
+ Alignment::Padding padding(1.0f, 1.5f, 2.f, 0.5f);
+ DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) > GetRangedEpsilon( padding.left, alignment.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) > GetRangedEpsilon( padding.right, alignment.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) > GetRangedEpsilon( padding.top, alignment.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) > GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) );
+
+ alignment.SetPadding(padding);
+ DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) < GetRangedEpsilon( padding.left, alignment.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) < GetRangedEpsilon( padding.right, alignment.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) < GetRangedEpsilon( padding.top, alignment.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) );
+ END_TEST;
+}
+
+int UtcDaliAlignmentSetPaddingNegative(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+
+ try
+ {
+ Alignment::Padding padding(-1.0f, 1.5f, 2.f, 0.f);
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ try
+ {
+ Alignment::Padding padding(1.0f, 1.5f, -2.f, 0.f);
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ try
+ {
+ Alignment::Padding padding(1.0f, 1.5f, 2.f, -1.f);
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ try
+ {
+ Alignment::Padding padding(1.0f, -1.5f, 2.f, 0.f);
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ END_TEST;
+}
+
+int UtcDaliAlignmentGetPadding(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK( fabs( alignment.GetPadding().left ) < GetRangedEpsilon( 0.f, alignment.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( alignment.GetPadding().right ) < GetRangedEpsilon( 0.f, alignment.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( alignment.GetPadding().top ) < GetRangedEpsilon( 0.f, alignment.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( alignment.GetPadding().bottom ) < GetRangedEpsilon( 0.f, alignment.GetPadding().bottom ) );
+
+ Alignment::Padding padding(1.0f, 1.5f, 2.f, 0.f);
+ alignment.SetPadding(padding);
+ DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) < GetRangedEpsilon( padding.left, alignment.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) < GetRangedEpsilon( padding.right, alignment.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) < GetRangedEpsilon( padding.top, alignment.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) );
+ END_TEST;
+}
+
+int UtcDaliAlignmentChildAddAndRemove(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Stage::GetCurrent().Add(alignment);
+
+ application.Render();
+ application.SendNotification();
+
+ Actor actor = RenderableActor::New();
+ alignment.Add(actor);
+
+ DALI_TEST_EQUALS(alignment.GetChildCount(), 1u, TEST_LOCATION);
+
+ application.Render();
+ application.SendNotification();
+
+ alignment.Remove(actor);
+
+ DALI_TEST_EQUALS(alignment.GetChildCount(), 0u, TEST_LOCATION);
+
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ END_TEST;
+}
+
+int UtcDaliAlignmentOnSizeSet(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Stage::GetCurrent().Add(alignment);
+
+ application.Render();
+ application.SendNotification();
+
+ Vector3 size(100.0f, 200.0f, 0.0f);
+ alignment.SetSize(size);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(size, alignment.GetImplementation().GetControlSize(), TEST_LOCATION);
+
+ Stage::GetCurrent().Remove(alignment);
+ END_TEST;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static bool TouchEventCallback(Actor actor, const TouchEvent& event)
+{
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+int UtcDaliAlignmentOnTouchEvent(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ alignment.SetSize(100.0f, 100.0f);
+ alignment.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(alignment);
+
+ alignment.TouchedSignal().Connect(&TouchEventCallback);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Integration::TouchEvent touchEvent(1);
+ TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
+ touchEvent.AddPoint(point);
+ application.ProcessEvent(touchEvent);
+
+ tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed.
+ END_TEST;
+}
+
+int UtcDaliAlignmentOnKeyEvent(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Stage::GetCurrent().Add(alignment);
+
+ alignment.SetKeyInputFocus();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Integration::KeyEvent keyEvent;
+ application.ProcessEvent(keyEvent);
+
+ tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed.
+ END_TEST;
+}
+
+int UtcDaliAlignmentOnSizeAnimation(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Stage::GetCurrent().Add(alignment);
+
+ Animation animation = Animation::New(100.0f);
+ animation.Resize(alignment, Vector3(100.0f, 150.0f, 200.0f));
+ animation.Play();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed.
+ END_TEST;
+}
+
+int UtcDaliAlignmentCopyAndAssignment(void)
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Alignment emptyAlignment;
+
+ Alignment::Padding padding(100.0f, 150.0f, 200.f, 0.f);
+ alignment.SetPadding(padding);
+
+ Alignment alignmentCopy(alignment);
+ DALI_TEST_CHECK( fabs( padding.left - alignmentCopy.GetPadding().left ) < GetRangedEpsilon( padding.left, alignmentCopy.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignmentCopy.GetPadding().right ) < GetRangedEpsilon( padding.right, alignmentCopy.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignmentCopy.GetPadding().top ) < GetRangedEpsilon( padding.top, alignmentCopy.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignmentCopy.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignmentCopy.GetPadding().bottom ) );
+
+ Alignment alignmentEmptyCopy(emptyAlignment);
+ DALI_TEST_CHECK(emptyAlignment == alignmentEmptyCopy);
+
+ Alignment alignmentEquals;
+ alignmentEquals = alignment;
+ DALI_TEST_CHECK( fabs( padding.left - alignmentEquals.GetPadding().left ) < GetRangedEpsilon( padding.left, alignmentEquals.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignmentEquals.GetPadding().right ) < GetRangedEpsilon( padding.right, alignmentEquals.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignmentEquals.GetPadding().top ) < GetRangedEpsilon( padding.top, alignmentEquals.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignmentEquals.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignmentEquals.GetPadding().bottom ) );
+
+ Alignment alignmentEmptyEquals;
+ alignmentEmptyEquals = emptyAlignment;
+ DALI_TEST_CHECK(emptyAlignment == alignmentEmptyEquals);
+
+ // Self assignment
+ alignment = alignment;
+ DALI_TEST_CHECK(alignment == alignmentCopy);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void utc_dali_toolkit_bubble_emitter_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_bubble_emitter_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+const int RENDER_FRAME_INTERVAL = 16;
+
+static bool gObjectCreatedCallBackCalled;
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+/*
+ * Simulate time passed by.
+ *
+ * @note this will always process at least 1 frame (1/60 sec)
+ *
+ * @param application Test application instance
+ * @param duration Time to pass in milliseconds.
+ * @return The actual time passed in milliseconds
+ */
+static int Wait(ToolkitTestApplication& application, int duration = 0)
+{
+ int time = 0;
+
+ for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ time += RENDER_FRAME_INTERVAL;
+ }
+
+ return time;
+}
+
+static Image CreateSolidColorImage( ToolkitTestApplication& application, const Vector4& color, unsigned int width, unsigned int height )
+{
+ BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 );
+
+ // Create the image
+ PixelBuffer* pixbuf = imageData.GetBuffer();
+ unsigned int size = width * height;
+
+ for( size_t i = 0; i < size; i++ )
+ {
+ pixbuf[i*4+0] = 0xFF * color.r;
+ pixbuf[i*4+1] = 0xFF * color.g;
+ pixbuf[i*4+2] = 0xFF * color.b;
+ pixbuf[i*4+3] = 0xFF * color.a;
+ }
+ imageData.Update();
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+
+ return imageData;
+}
+}//namespace
+
+
+int UtcDaliBubbleEmitterNew(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBubbleEmitterNew ");
+
+ // Test default constructor
+ BubbleEmitter emitter;
+ DALI_TEST_CHECK( !emitter );
+
+ // Test object creation
+ Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+ DALI_TEST_CHECK( emitter );
+
+ // Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ // Test copy constructor
+ BubbleEmitter emitterCopy( emitter );
+ DALI_TEST_CHECK( emitterCopy );
+
+ // Test down cast
+ Handle handleEmitter;
+ handleEmitter = emitter;
+ BubbleEmitter downCastEmitter = BubbleEmitter::DownCast( handleEmitter );
+ DALI_TEST_CHECK( downCastEmitter );
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterGetRootActor(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterGetRootActor " );
+
+ Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ DALI_TEST_CHECK( root );
+ DALI_TEST_CHECK( root.GetChildCount() == 3 );
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterSetBackground(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBackground " );
+
+ Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ unsigned int taskCount = taskList.GetTaskCount();
+
+ Image bgImage = CreateSolidColorImage( application, Color::RED, 50, 50 );
+ emitter.SetBackground( bgImage, Vector3(0.f, 0.f, 0.5f) );
+
+ DALI_TEST_CHECK( taskList.GetTaskCount() == taskCount+1 );
+
+ Wait(application, 500);
+ DALI_TEST_CHECK( taskList.GetTaskCount() == taskCount );
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterSetShapeImage(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetShapeImage " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ Material material = bubbleMesh.GetMaterial();
+
+ DALI_TEST_CHECK( material.GetDiffuseTexture() == shapeImage1 );
+
+ Image shapeImage2 = CreateSolidColorImage( application, Color::RED, 8, 8 );
+ emitter.SetShapeImage( shapeImage2 );
+
+ DALI_TEST_CHECK( material.GetDiffuseTexture() == shapeImage2 );
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterSetBubbleScale(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBubbleScale " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ ShaderEffect effect = bubbleMesh.GetShaderEffect();
+ DALI_TEST_CHECK( effect );
+
+ Property::Index scalePropertyIndex = effect.GetPropertyIndex( "uDynamicScale" );
+ float scaleValue;
+ (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
+ DALI_TEST_EQUALS(scaleValue, 1.f, TEST_LOCATION );
+
+ emitter.SetBubbleScale( 2.f );
+ application.SendNotification();
+ application.Render();
+ (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
+ DALI_TEST_EQUALS(scaleValue, 2.f, TEST_LOCATION );
+
+ emitter.SetBubbleScale( 0.5f );
+ application.SendNotification();
+ application.Render();
+ (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
+ DALI_TEST_EQUALS(scaleValue, 0.5f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterSetBubbleDensity01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBubbleDensity " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ try
+ {
+ emitter.SetBubbleDensity( 3.f );
+ DALI_TEST_CHECK(true);
+ }
+ catch(Dali::DaliException& e)
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_ASSERT(e, "density>0 && density<=9", TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterSetBubbleDensity02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBubbleDensity " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ try
+ {
+ emitter.SetBubbleDensity( 10.f );
+ }
+ catch(Dali::DaliException& e)
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_ASSERT(e, "density>0 && density<=9", TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterSetBlendMode(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBlendMode " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+
+ BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
+
+ emitter.SetBlendMode( true );
+ bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+ DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA );
+ DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ZERO );
+ DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE );
+
+ emitter.SetBlendMode( false );
+ bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+ DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA );
+ DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
+ DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE_MINUS_SRC_ALPHA );
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterEmitBubble(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterEmitBubble " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ ShaderEffect effect = bubbleMesh.GetShaderEffect();
+ DALI_TEST_CHECK( effect );
+
+ Property::Index propertyIndex0 = effect.GetPropertyIndex( "uPercentage[0]" );
+ Property::Index propertyIndex1 = effect.GetPropertyIndex( "uPercentage[1]" );
+ float value0, value1;
+
+ Animation animation = Animation::New( 0.5f );
+ emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );
+ emitter.EmitBubble( animation, Vector2(10.f,10.f), Vector2(5.f,5.f), Vector2(30.f,30.f) );
+ (effect.GetProperty(propertyIndex0)).Get( value0 );
+ (effect.GetProperty(propertyIndex1)).Get( value1 );
+ DALI_TEST_EQUALS(value0, 0.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(value1, 0.f, TEST_LOCATION );
+
+ animation.Play();
+
+ Wait(application, 300);
+ (effect.GetProperty(propertyIndex0)).Get( value0 );
+ (effect.GetProperty(propertyIndex1)).Get( value1 );
+ DALI_TEST_CHECK( value0 >= 0.6f );
+ DALI_TEST_CHECK( value1 >= 0.6f );
+
+ Wait(application, 600);
+ (effect.GetProperty(propertyIndex0)).Get( value0 );
+ (effect.GetProperty(propertyIndex1)).Get( value1 );
+ DALI_TEST_EQUALS(value0, 1.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(value1, 1.f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterStartExplosion(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterStartExplosion " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ ShaderEffect effect = bubbleMesh.GetShaderEffect();
+ DALI_TEST_CHECK( effect );
+
+ Property::Index propertyIndex = effect.GetPropertyIndex( "uMagnification" );
+ float value;
+ (effect.GetProperty(propertyIndex)).Get( value );
+ DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION );
+
+ emitter.StartExplosion( 0.4, 4.f );
+
+ Wait(application, 200); // 0.2s
+ (effect.GetProperty(propertyIndex)).Get( value );
+ DALI_TEST_CHECK( value >= 2.f );
+
+ Wait(application, 100); // 0.3s
+ (effect.GetProperty(propertyIndex)).Get( value );
+ DALI_TEST_CHECK( value >= 3.f );
+
+ Wait(application, 100); // 0.4s
+ (effect.GetProperty(propertyIndex)).Get( value );
+ DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliBubbleEmitterRestore(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterRestore " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ ShaderEffect effect = bubbleMesh.GetShaderEffect();
+ DALI_TEST_CHECK( effect );
+
+ Property::Index percentagePropertyIndex = effect.GetPropertyIndex( "uPercentage[0]" );
+ float percentage;
+
+ Animation animation = Animation::New( 0.5f );
+ emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );
+ (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
+ DALI_TEST_EQUALS(percentage, 0.f, TEST_LOCATION );
+
+ animation.Play();
+ Wait(application, 200);
+ animation.Clear();
+
+ (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
+ DALI_TEST_CHECK( percentage < 0.5f && percentage >= 0.4);
+
+ emitter.Restore();
+ application.SendNotification();
+ application.Render();
+
+ (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
+ DALI_TEST_EQUALS(percentage, 1.f, TEST_LOCATION );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+
+void utc_dali_toolkit_button_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_button_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+static bool gButtonClicked = false;
+
+static bool ButtonClicked( Button button )
+{
+ gButtonClicked = true;
+ return false;
+}
+
+const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 );
+const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 );
+const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 );
+const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 );
+const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 );
+const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 );
+
+static float ANIMATION_TIME( 0.5f );
+} // namespace
+
+
+
+// Positive test case for a method
+int UtcDaliButtonNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonNew");
+
+ PushButton pushButton = PushButton::New();
+
+ DALI_TEST_CHECK( pushButton );
+
+ PushButton pushButton2( pushButton );
+
+ DALI_TEST_CHECK( pushButton2 );
+
+ pushButton2 = NULL;
+
+ // Test down cast
+ Handle handleButton;
+ handleButton = pushButton;
+ Button downCastPushButton = Button::DownCast( handleButton );
+ DALI_TEST_CHECK( downCastPushButton );
+ PushButton downCastPushButton2 = PushButton::DownCast( handleButton );
+ DALI_TEST_CHECK( downCastPushButton2 );
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetProperty(void)
+{
+ tet_infoline("UtcDaliButtonSetProperty: ");
+ ToolkitTestApplication application;
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetProperty(pushButton.GetPropertyIndex("dimmed"), false);
+ DALI_TEST_CHECK( false == pushButton.IsDimmed() );
+ pushButton.SetProperty(pushButton.GetPropertyIndex("dimmed"), true);
+ DALI_TEST_CHECK( true == pushButton.IsDimmed() );
+ END_TEST;
+}
+
+int UtcDaliButtonSetGetDimmed(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetGetDimmed");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetDimmed( true );
+
+ DALI_TEST_CHECK( pushButton.IsDimmed() );
+
+ pushButton.SetDimmed( false );
+
+ DALI_TEST_CHECK( !pushButton.IsDimmed() );
+
+ pushButton.SetDimmed( true );
+
+ DALI_TEST_CHECK( pushButton.IsDimmed() );
+
+ pushButton.SetDimmed( false );
+
+ DALI_TEST_CHECK( !pushButton.IsDimmed() );
+ END_TEST;
+}
+
+int UtcDaliButtonSize(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSize");
+
+ ImageActor image01 = ImageActor::New(CreateBitmapImage());
+ image01.SetSize( 100, 50 );
+
+ PushButton pushButton;
+
+ Vector3 size;
+
+ // Test1 Size is set through Actor API
+
+ // First an image is set, then SetSize is called.
+ pushButton = PushButton::New();
+
+ pushButton.SetBackgroundImage( image01 );
+ pushButton.SetSize( 10.f, 10.f );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliButtonClicked(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonClicked");
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ // connect to its touch signal
+ pushButton.ClickedSignal().Connect( &ButtonClicked );
+
+ Dali::Integration::TouchEvent event;
+
+ // Test1. Touch point down and up inside the button.
+
+ gButtonClicked = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gButtonClicked );
+
+ // Test2. Touch point down and up outside the button.
+
+ gButtonClicked = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gButtonClicked );
+
+ // Test3. Touch point down inside and up outside the button.
+
+ gButtonClicked = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointLeave );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gButtonClicked );
+
+ // Test4. Touch point down outside and up inside the button.
+
+ gButtonClicked = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointEnter );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gButtonClicked );
+ END_TEST;
+}
+
+namespace
+{
+
+static bool gClickedCallBackCalled;
+
+static bool TestClickedCallback(Button button)
+{
+ gClickedCallBackCalled = true;
+ return true;
+}
+
+} // namespace
+
+int UtcDaliButtonConnectSignal(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliButtonConnectSignal()");
+
+ gClickedCallBackCalled = false;
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ // connect to its clicked signal
+ pushButton.ClickedSignal().Connect(TestClickedCallback);
+
+ Dali::Integration::TouchEvent event;
+
+ // Touch point down and up inside the button.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gClickedCallBackCalled == true );
+
+ gClickedCallBackCalled = false;
+ pushButton.ClickedSignal().Disconnect(TestClickedCallback);
+
+ // simulate another touch event
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gClickedCallBackCalled == false );
+ END_TEST;
+}
+
+int UtcDaliButtonSetGetAnimationTime(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetGetAnimationTime");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAnimationTime( ANIMATION_TIME );
+
+ DALI_TEST_EQUALS( pushButton.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION );
+
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include "dummy-control.h"
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void utc_dali_toolkit_control_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_control_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+} // namespace
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+int UtcDaliControlConstructor(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ DummyControl dummy;
+
+ DALI_TEST_CHECK( !Control::DownCast(dummy) );
+
+ dummy = DummyControl::New();
+
+ DALI_TEST_CHECK( Control::DownCast(dummy) );
+ END_TEST;
+}
+
+int UtcDaliControlNew(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control;
+
+ DALI_TEST_CHECK( !Control::DownCast(control) );
+
+ control = Control::New();
+
+ DALI_TEST_CHECK( Control::DownCast(control) );
+ END_TEST;
+}
+
+
+int UtcDaliControlRegister(void)
+{
+ ToolkitTestApplication application;
+
+ // Ensure the object is registered after creation
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ Alignment alignment = Alignment::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliControlCopyAndAssignment(void)
+{
+ ToolkitTestApplication application;
+
+ DummyControl control = DummyControl::New();
+ Control emptyControl;
+
+ Control controlCopy( control );
+ DALI_TEST_CHECK( control == controlCopy );
+
+ Control emptyControlCopy( emptyControl );
+ DALI_TEST_CHECK( emptyControl == emptyControlCopy );
+
+ Control controlEquals;
+ controlEquals = control;
+ DALI_TEST_CHECK( control == controlEquals );
+
+ Control emptyControlEquals;
+ emptyControlEquals = emptyControl;
+ DALI_TEST_CHECK( emptyControl == emptyControlEquals );
+
+ // Self assignment
+ control = control;
+ DALI_TEST_CHECK( control == controlCopy );
+ END_TEST;
+}
+
+int UtcDaliControlDownCast(void)
+{
+ ToolkitTestApplication application;
+
+ DummyControl control;
+
+ DALI_TEST_CHECK( !Control::DownCast( control ) );
+
+ control = DummyControl::New();
+
+ DALI_TEST_CHECK( Control::DownCast( control ) );
+
+ Actor actor;
+
+ DALI_TEST_CHECK( !Control::DownCast( actor ) );
+
+ actor = Actor::New();
+
+ DALI_TEST_CHECK( !Control::DownCast( actor ) );
+ END_TEST;
+}
+
+int UtcDaliControlDownCastTemplate(void)
+{
+ ToolkitTestApplication application;
+
+ DummyControl control;
+
+ DALI_TEST_CHECK( !DummyControl::DownCast( control ));
+
+ control = DummyControl::New();
+
+ DALI_TEST_CHECK( DummyControl::DownCast( control ) );
+
+ Actor actor;
+
+ DALI_TEST_CHECK( !DummyControl::DownCast( actor ) );
+
+ actor = Actor::New();
+
+ DALI_TEST_CHECK( !DummyControl::DownCast( actor ) );
+ END_TEST;
+}
+
+int UtcDaliControlKeyInputFocus(void)
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ DummyControl control;
+
+ PushButton pushButton1 = PushButton::New();
+ stage.Add( pushButton1 );
+
+ pushButton1.SetKeyInputFocus();
+ DALI_TEST_CHECK( pushButton1.HasKeyInputFocus() );
+
+ pushButton1.ClearKeyInputFocus();
+ DALI_TEST_CHECK( !pushButton1.HasKeyInputFocus() );
+ END_TEST;
+}
+
+int UtcDaliControlGetImplementation(void)
+{
+ ToolkitTestApplication application;
+
+ DummyControl control;
+
+ // Get Empty
+ {
+ try
+ {
+ ControlImpl& controlImpl = control.GetImplementation();
+ (void)controlImpl; // Avoid unused warning
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException &exception)
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ // Get Const Empty
+ {
+ try
+ {
+ const DummyControl constControl(control);
+ const ControlImpl& controlImpl = constControl.GetImplementation();
+ (void)controlImpl; // Avoid unused warning
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException &exception)
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ control = DummyControl::New();
+
+ // Get
+ {
+ try
+ {
+ ControlImpl& controlImpl = control.GetImplementation();
+ (void)controlImpl; // Avoid unused warning
+ tet_result(TET_PASS);
+ }
+ catch (DaliException &exception)
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+
+ // Get Const
+ {
+ try
+ {
+ const DummyControl constControl(control);
+ const ControlImpl& controlImpl = constControl.GetImplementation();
+ (void)controlImpl; // Avoid unused warning
+ tet_result(TET_PASS);
+ }
+ catch (DaliException &exception)
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+ END_TEST;
+}
+
+int UtcDaliControlSignalConnectDisconnect(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControlImpl::New();
+
+ Actor actor = Actor::New();
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+ actor.SetSizeSignal().Connect( &dummy, &DummyControl::CustomSlot1 );
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, Vector3::ZERO, TEST_LOCATION );
+
+ const Vector3 newSize( 10, 10, 0 );
+ actor.SetSize( newSize );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize, TEST_LOCATION );
+
+ dummy.mCustomSlot1Called = false;
+ actor.SetSizeSignal().Disconnect( &dummy, &DummyControl::CustomSlot1 );
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+ const Vector3 ignoredSize( 20, 20, 0 );
+ actor.SetSize( ignoredSize );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize/*not ignoredSize*/, TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliControlSignalAutomaticDisconnect(void)
+{
+ ToolkitTestApplication application;
+
+ Actor actor = Actor::New();
+
+ {
+ DummyControl dummy = DummyControlImpl::New();
+
+ actor.SetSizeSignal().Connect( &dummy, &DummyControl::CustomSlot1 );
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, Vector3::ZERO, TEST_LOCATION );
+
+ const Vector3 newSize( 10, 10, 0 );
+ actor.SetSize( newSize );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize, TEST_LOCATION );
+ }
+ // dummyControl automatically disconnects
+
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+
+ const Vector3 ignoredSize( 20, 20, 0 );
+ actor.SetSize( ignoredSize );
+ END_TEST;
+}
+
+int UtcDaliControlTestParameters(void)
+{
+ ToolkitTestApplication application;
+ DummyControl test = DummyControl::New();
+
+ Vector3 maxSize = test.GetNaturalSize();
+ Vector3 minSize = maxSize / 2.0f;
+
+ Toolkit::Control::SizePolicy widthPolicy( Control::Fixed );
+ Toolkit::Control::SizePolicy heightPolicy( Control::Fixed );
+ test.SetSizePolicy( widthPolicy, heightPolicy );
+ test.GetSizePolicy( widthPolicy, heightPolicy );
+
+ DALI_TEST_CHECK( widthPolicy == Control::Fixed && heightPolicy == Control::Fixed );
+
+ test.SetSize( 0.7f, 0.7f, 0.7f );
+ float width = 640.0f;
+ float height = test.GetHeightForWidth( width );
+ DALI_TEST_CHECK( test.GetWidthForHeight( height ) == width );
+
+ test.SetMinimumSize( minSize );
+ DALI_TEST_CHECK( test.GetMinimumSize() == minSize );
+
+ test.SetMaximumSize( maxSize );
+ DALI_TEST_CHECK( test.GetMaximumSize() == maxSize );
+
+ test.KeyEventSignal();
+ DummyControl test2 = DummyControl::New();
+ dynamic_cast< ConnectionTrackerInterface& >( test2 ).GetConnectionCount();
+
+ // Provide coverage for pointer destructor
+ Control* testControlPtr = new Control;
+ DALI_TEST_CHECK( testControlPtr );
+ delete testControlPtr;
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/long-press-gesture-event.h>
+#include <dali/integration-api/events/pinch-gesture-event.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali/integration-api/events/tap-gesture-event.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+
+#include "dummy-control.h"
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void utc_dali_toolkit_control_impl_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_control_impl_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliControlImplNew(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control;
+
+ DALI_TEST_CHECK( !Control::DownCast(control) );
+
+ control = ControlImpl::New();
+
+ DALI_TEST_CHECK( Control::DownCast(control) );
+ END_TEST;
+}
+
+
+int UtcDaliControlImplEnableGestureDetector(void)
+{
+ ToolkitTestApplication application;
+
+ // Enable individually
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(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<DummyControlImpl&>(dummy.GetImplementation());
+
+ DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
+
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
+
+ // Enable when already enabled
+
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
+ }
+ END_TEST;
+}
+
+int UtcDaliControlImplDisableGestureDetector(void)
+{
+ ToolkitTestApplication application;
+
+ // Disable individually
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(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<DummyControlImpl&>(dummy.GetImplementation());
+
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ PinchGestureDetector pinch = dummyImpl.GetPinchGestureDetector();
+ PanGestureDetector pan = dummyImpl.GetPanGestureDetector();
+ TapGestureDetector tap = dummyImpl.GetTapGestureDetector();
+ LongPressGestureDetector longPress = dummyImpl.GetLongPressGestureDetector();
+
+ DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), false, TEST_LOCATION );
+
+ dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), true, TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliControlImplOnGestureMethods(void)
+{
+ ToolkitTestApplication application;
+
+ // Check gesture actually happens
+ {
+ DummyControl dummy = DummyControl::New(true);
+ dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
+
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ // Render and notify a couple of times
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(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<DummyControlImpl&>(dummy.GetImplementation());
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f );
+ Integration::PinchGestureEvent pinch(Gesture::Started);
+ pinch.scale = 10.0f;
+ pinch.speed = 50.0f;
+ pinch.centerPoint = Vector2(20.0f, 20.0f);
+ application.ProcessEvent(pinch);
+
+ // Render and notify a couple of times
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f );
+
+ Integration::PanGestureEvent pan(Gesture::Possible);
+ pan.previousPosition = Vector2(10.0f, 20.0f);
+ pan.currentPosition = Vector2(20.0f, 20.0f);
+ pan.timeDelta = 10;
+ pan.numberOfTouches = 1u;
+ application.ProcessEvent(pan);
+ pan.state = Gesture::Started;
+ application.ProcessEvent(pan);
+
+ Integration::TapGestureEvent tap(Gesture::Possible);
+ tap.numberOfTaps = 1u;
+ tap.numberOfTouches = 1u;
+ tap.point = Vector2(50.0f, 50.0f);
+ application.ProcessEvent(tap);
+ tap.state = Gesture::Started;
+ application.ProcessEvent(tap);
+
+ Integration::LongPressGestureEvent longPress(Gesture::Possible);
+ longPress.numberOfTouches = 1u;
+ longPress.point = Vector2(50.0f, 50.0f);
+ application.ProcessEvent(longPress);
+ longPress.state = Gesture::Started;
+ application.ProcessEvent(longPress);
+ longPress.state = Gesture::Finished;
+ application.ProcessEvent(longPress);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
+
+int UtcDaliControlImplChildAddAndRemove(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ Stage::GetCurrent().Add(dummy);
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.childAddCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
+ Actor actor = RenderableActor::New();
+ dummy.Add(actor);
+ DALI_TEST_EQUALS( dummyImpl.childAddCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, false, TEST_LOCATION );
+ dummy.Remove( actor );
+ DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
+
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+ Stage::GetCurrent().Add(dummy);
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
+ Actor actor = RenderableActor::New();
+ dummy.Add(actor);
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
+
+ application.Render();
+ application.SendNotification();
+
+ dummy.Remove( actor );
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
+
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
+
+int UtcDaliControlImplStageConnection(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, false, TEST_LOCATION );
+ Stage::GetCurrent().Add(dummy);
+ application.Render();
+ application.SendNotification();
+ DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, false, TEST_LOCATION );
+ Stage::GetCurrent().Remove(dummy);
+ application.Render();
+ application.SendNotification();
+ DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, true, TEST_LOCATION );
+ }
+
+ // Ensure full code coverage
+ {
+ unsigned int stageChildren = Stage::GetCurrent().GetLayer(0).GetChildCount();
+ DummyControl dummy = DummyControl::New();
+
+ DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
+ Stage::GetCurrent().Add(dummy);
+ application.Render();
+ application.SendNotification();
+ DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren + 1, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ application.Render();
+ application.SendNotification();
+ DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliControlImplSizeSet(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION );
+ Vector3 size(100.0f, 200.0f, 0.0f);
+ dummy.SetSize(size);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
+ DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+ Stage::GetCurrent().Add(dummy);
+
+ Vector3 size(100.0f, 200.0f, 0.0f);
+ DALI_TEST_CHECK( size != dummy.GetCurrentSize() );
+
+ application.Render();
+ application.SendNotification();
+
+ dummy.SetSize(size);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
+
+int UtcDaliControlImplSizeAnimation(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+
+ DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
+ Animation animation = Animation::New(1.0f);
+ animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
+ animation.Play();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ Stage::GetCurrent().Add(dummy);
+
+ Animation animation = Animation::New(1.0f);
+ animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
+ animation.Play();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+int UtcDaliControlImplTouchEvent(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ dummy.SetSize(100.0f, 100.0f);
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION );
+ Integration::TouchEvent touchEvent(1);
+ TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
+ touchEvent.AddPoint(point);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ dummy.SetSize(100.0f, 100.0f);
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Integration::TouchEvent touchEvent(1);
+ TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
+ touchEvent.AddPoint(point);
+ application.ProcessEvent(touchEvent);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+int UtcDaliControlImplKeyEvent(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+ dummy.SetKeyInputFocus();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.keyEventCalled, false, TEST_LOCATION );
+ Integration::KeyEvent keyEvent;
+ application.ProcessEvent(keyEvent);
+ DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ Stage::GetCurrent().Add(dummy);
+ dummy.SetKeyInputFocus();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Integration::KeyEvent keyEvent;
+ application.ProcessEvent(keyEvent);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
+
+int UtcDaliControlImplStyleChange(void)
+{
+ ToolkitTestApplication application;
+
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ // Add a Control and normal Actor as children
+ DummyControl dummyChild = DummyControl::New();
+ dummy.Add(dummyChild);
+
+ Actor actor = Actor::New();
+ dummy.Add(actor);
+
+ DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, false, TEST_LOCATION );
+ StyleChange styleChange;
+ styleChange.defaultFontChange = true;
+ Dali::StyleMonitor styleMonitor = application.GetAdaptor().GetToolkitStyleMonitor();
+ styleMonitor.EmitStyleChangeSignal(styleChange);
+
+ DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ END_TEST;
+}
+
+int UtcDaliControlImplKeyInputFocusGained(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+
+ DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, false, TEST_LOCATION );
+
+ dummy.SetKeyInputFocus();
+
+ DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ Stage::GetCurrent().Add(dummy);
+ dummy.SetKeyInputFocus();
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
+
+int UtcDaliControlImplKeyInputFocusLost(void)
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(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<DummyControlImplOverride&>(dummy.GetImplementation());
+
+ dummyImpl.OnAccessibilityValueChange( true );
+ dummyImpl.IsKeyboardNavigationSupported();
+ dummyImpl.IsKeyboardFocusGroup();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void utc_dali_toolkit_default_controls_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_default_controls_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliDefaultControlsCreateSolidColorActor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliDefaultControlsCreateSolidColorActor");
+
+ ImageActor image1 = CreateSolidColorActor( Color::RED );
+ ImageActor image2 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 2 );
+ ImageActor image3 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 12 );
+
+ DALI_TEST_CHECK(image1);
+ DALI_TEST_CHECK(image2);
+ DALI_TEST_CHECK(!image3);
+ END_TEST;
+}
+
+int UtcDaliDefaultControlsCreatePushButton(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliDefaultControlsCreatePushButton");
+
+ const std::string imagePath( "Facke image path" );
+ const std::string voidImagePath( "" );
+
+ ImageActor image = CreateSolidColorActor( Color::RED );
+ ImageActor voidImage;
+
+ PushButton button0, button1, button2, button3, button4, button5, button6;
+
+ try
+ {
+ button0 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath );
+ button1 = CreatePushButton( imagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath );
+ button2 = CreatePushButton( voidImagePath, imagePath, voidImagePath, voidImagePath, voidImagePath );
+ button3 = CreatePushButton( voidImagePath, voidImagePath, imagePath, voidImagePath, voidImagePath );
+ button4 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, imagePath, voidImagePath );
+ button5 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, imagePath );
+ button6 = CreatePushButton( imagePath, imagePath, imagePath, imagePath, imagePath );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ DALI_TEST_CHECK( button4 );
+ DALI_TEST_CHECK( button5 );
+ DALI_TEST_CHECK( button6 );
+
+ try
+ {
+ button0 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, voidImage );
+ button1 = CreatePushButton( image, voidImage, voidImage, voidImage, voidImage );
+ button2 = CreatePushButton( voidImage, image, voidImage, voidImage, voidImage );
+ button3 = CreatePushButton( voidImage, voidImage, image, voidImage, voidImage );
+ button4 = CreatePushButton( voidImage, voidImage, voidImage, image, voidImage );
+ button5 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, image );
+ button6 = CreatePushButton( image, image, image, image, image );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ DALI_TEST_CHECK( button4 );
+ DALI_TEST_CHECK( button5 );
+ DALI_TEST_CHECK( button6 );
+
+ try
+ {
+ button0 = CreatePushButton( voidImagePath );
+ button1 = CreatePushButton( imagePath );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+
+ try
+ {
+ button0 = CreatePushButton( voidImage );
+ button1 = CreatePushButton( image );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+
+void utc_dali_toolkit_dissolve_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_dissolve_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliDissolveUninitializedEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DissolveEffect effect;
+
+ try
+ {
+ // New() must be called to create a DissolveEffect or it wont be valid.
+ effect.SetDistortion( 2.0f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliDissolvePropertyNamesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DissolveEffect effectHighPrecision = Toolkit::DissolveEffect::New();
+ Toolkit::DissolveEffect effectMediumPrecision = Toolkit::DissolveEffect::New( false );
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effectHighPrecision.GetDistortionPropertyName(), "uPercentage", TEST_LOCATION );
+ DALI_TEST_EQUALS( effectMediumPrecision.GetDistortionPropertyName(), "uPercentage", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliDissolveDefaultValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ effect.SetCentralLine( Vector2(0.0,0.5), Vector2(1.0, -0.1) );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
+ float value;
+ (effect.GetProperty(index)).Get( value );
+ DALI_TEST_EQUALS(value, 0.f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliDissolveCustomValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ effect.SetDistortion( 0.5f );
+
+ actor.SetShaderEffect(effect);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
+ float value;
+ (effect.GetProperty(index)).Get( value );
+ DALI_TEST_EQUALS(value, 0.5f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSetEffectImageEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ Image effectImage = CreateBitmapImage();
+ effect.SetEffectImage(effectImage);
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
+ float value;
+ (effect.GetProperty(index)).Get( value );
+ DALI_TEST_EQUALS(value, 0.f, TEST_LOCATION );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+
+void utc_dali_toolkit_focus_manager_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_focus_manager_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+// Functors to test whether focus changed signal is emitted when the focus is changed
+class FocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mOriginalFocusedActor(),
+ mCurrentFocusedActor()
+ {
+ }
+
+ void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
+ {
+ tet_infoline("Verifying FocusChangedCallback()");
+
+ if(originalFocusedActor == mCurrentFocusedActor)
+ {
+ mSignalVerified = true;
+ }
+
+ mOriginalFocusedActor = originalFocusedActor;
+ mCurrentFocusedActor = currentFocusedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mOriginalFocusedActor;
+ Actor mCurrentFocusedActor;
+};
+
+// Functors to test whether focus overshot signal is emitted when there is no way to move focus further.
+class FocusOvershotCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusOvershotCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mFocusOvershotDirection(Toolkit::FocusManager::OVERSHOT_NEXT)
+ {
+ }
+
+ void Callback(Actor currentFocusedActor, Toolkit::FocusManager::FocusOvershotDirection direction)
+ {
+ tet_infoline("Verifying FocusOvershotCallback()");
+
+ if(currentFocusedActor == mCurrentFocusedActor && direction == mFocusOvershotDirection)
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ Toolkit::FocusManager::FocusOvershotDirection mFocusOvershotDirection;
+};
+
+} // namespace
+
+
+int UtcDaliFocusManagerGet(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGet");
+
+ FocusManager manager;
+
+ //Ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK(registry);
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ FocusManager newManager = FocusManager::Get();
+ DALI_TEST_CHECK(newManager);
+
+ // Check that focus manager is a singleton
+ DALI_TEST_CHECK(manager == newManager);
+ END_TEST;
+}
+
+int UtcDaliFocusManagerSetAndGetAccessibilityAttribute(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSetAndGetAccessibilityAttribute");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "");
+
+ manager.SetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL, "Description");
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "Description");
+
+ manager.SetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL, "New description");
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "New description");
+ END_TEST;
+}
+
+int UtcDaliFocusManagerSetAndGetFocusOrder(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSetAndGetFocusOrder");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Actor second = Actor::New();
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 0);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // check that the focus order of the first actor is changed
+ manager.SetFocusOrder(first, 2);
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 2);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // check that the focus order of the second actor is increased to 3
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 3);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // check that the focus order of the second actor is changed to 1
+ manager.SetFocusOrder(second, 1);
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 1);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Set the focus order and description for the third actor
+ Actor third = Actor::New();
+ manager.SetFocusOrder(third, 1);
+ manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // check that the focus order of the second actor is increased to 2.
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // check that the focus order of the first actor is increased to 3.
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 3);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+ END_TEST;
+}
+
+int UtcDaliFocusManagerGenerateNewFocusOrder(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGenerateNewFocusOrder");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
+ DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
+
+ Actor first = Actor::New();
+ Actor second = Actor::New();
+
+ // Set the focus order for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+
+ //Test for new focus order
+ DALI_TEST_CHECK(2 == manager.GenerateNewFocusOrder());
+
+ // Set the focus order for the first actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ END_TEST;
+}
+
+int UtcDaliFocusManagerGetActorByFocusOrder(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGetActorByFocusOrder");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the actors and set their focus orders
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+
+ Actor third = Actor::New();
+ manager.SetFocusOrder(third, 3);
+
+ // Check that we get an empty handle as no actor is added to the stage yet.
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == Actor());
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == Actor());
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == Actor());
+
+ // Add the actors to the stage
+ Stage::GetCurrent().Add(first);
+ Stage::GetCurrent().Add(second);
+ Stage::GetCurrent().Add(third);
+
+ // Check that we get an empty handle because focus order 0 means undefined.
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(0) == Actor());
+
+ // Check that we get correct actors for the specified focus orders
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == first);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == second);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == third);
+
+ // Change the focus order of the third actor to 1
+ manager.SetFocusOrder(third, 1);
+
+ // Check that we still get correct actors after changing their focus orders
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == third);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == first);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == second);
+
+ // Check that we get an empty handle because no actor has a focus order of 4
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(4) == Actor());
+ END_TEST;
+}
+
+int UtcDaliFocusManagerSetAndGetCurrentFocusActor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSetAndGetCurrentFocusActor");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Create the third actor but don't add it to the stage
+ Actor third = Actor::New();
+ manager.SetFocusOrder(third, 3);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that it will fail to set focus on an invalid actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Check that it will fail to set focus on the third actor as it's not in the stage
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Add the third actor to the stage
+ Stage::GetCurrent().Add(third);
+
+ // make the third actor invisible
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that it will fail to set focus on the third actor as it's invisible
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Make the third actor visible
+ third.SetVisible(true);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Make the third actor not focusable
+ Property::Index propertyActorFocusable = third.GetPropertyIndex("focusable");
+ third.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that it will fail to set focus on the third actor as it's not focusable
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Make the third actor focusable
+ third.SetProperty(propertyActorFocusable, true);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the focus is successfully moved to the third actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+
+ // Make the current focused actor to be not focusable by setting its focus order to be 0
+ manager.SetFocusOrder(third, 0);
+
+ // Check that the focus is automatically cleared
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Set the focus order of the third actor again
+ manager.SetFocusOrder(third, 3);
+
+ // Check that the third actor can be focused successfully now
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+ END_TEST;
+}
+
+int UtcDaliFocusManagerGetCurrentFocusGroup(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGetCurrentFocusGroup");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor with two child actors and add it to the stage
+ Actor parent = Actor::New();
+ Actor firstChild = Actor::New();
+ Actor secondChild = Actor::New();
+ parent.Add(firstChild);
+ parent.Add(secondChild);
+ Stage::GetCurrent().Add(parent);
+
+ // Create three actors and add them as the children of the first child actor
+ Actor firstGrandChild = Actor::New();
+ Actor secondGrandChild = Actor::New();
+ Actor thirdGrandChild = Actor::New();
+ firstChild.Add(firstGrandChild);
+ firstChild.Add(secondGrandChild);
+ firstChild.Add(thirdGrandChild);
+
+ // Set focus order to the actors
+ manager.SetFocusOrder(parent, 1);
+ manager.SetFocusOrder(firstChild, 2);
+ manager.SetFocusOrder(firstGrandChild, 3);
+ manager.SetFocusOrder(secondGrandChild, 4);
+ manager.SetFocusOrder(thirdGrandChild, 5);
+ manager.SetFocusOrder(secondChild, 6);
+
+ // Set the parent and the first child actor as focus groups
+ manager.SetFocusGroup(parent, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
+
+ // Set focus to the first grand child actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstGrandChild) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+
+ // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == parent);
+
+ manager.SetFocusGroup(firstChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
+
+ // The current focus group should be the firstChild, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
+
+ manager.SetFocusGroup(firstGrandChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstGrandChild) == true);
+
+ // The current focus group should be itself, As it is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstGrandChild);
+
+ // Set focus to the second grand child actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondGrandChild) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+
+ // The current focus group should be the firstChild, As it is the immediate parent which is also a
+ // focus group for the current focus actor.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
+
+ END_TEST;
+}
+
+int UtcDaliFocusManagerGetCurrentFocusOrder(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGetCurrentFocusOrder");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(third, 3);
+ manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
+
+ // Set the focus on the first actor and test
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 1);
+
+ // Move the focus forward to the second actor and test
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 2);
+
+ // Move the focus forward to the third actor and test
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 3);
+
+ // Clear focus and test
+ manager.ClearFocus();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
+ END_TEST;
+}
+
+int UtcDaliFocusManagerMoveFocusForward(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerMoveFocusForward");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(third, 3);
+ manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Set the focus on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Test the non-wrapped move first
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Move the focus forward to the second actor
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Move the focus forward to the third actor
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that it will fail to move the focus forward again as the third actor is the last
+ // focusable actor in the focus chain
+ manager.MoveFocusForward();
+ // The focus should still be set on the third actor
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Now test the wrapped move
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Move the focus forward recursively and this time the first actor should be focused
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the second actor not focusable
+ Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
+ second.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus forward and check that the second actor should be skipped and
+ // the third actor should be focused now.
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the first actor invisible
+ first.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus forward and check that the first actor should be skipped as it's
+ // invisible and the second actor should also be skipped as it's not focusable,
+ // so the focus will still be on the third actor
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the third actor invisible so that no actor can be focused.
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the focus move is failed as all the three actors can not be focused
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+ END_TEST;
+}
+
+int UtcDaliFocusManagerMoveFocusBackward(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerMoveFocusBackward");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(third, 3);
+ manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Set the focus on the third actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Test the non-wrapped move first
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Move the focus backward to the second actor
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Move the focus backward to the first actor
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Check that it will fail to move the focus backward again as the first actor is the first
+ // focusable actor in the focus chain
+ manager.MoveFocusBackward();
+ // The focus should still be set on the first actor
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Now test the wrapped move
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Move the focus backward recursively and this time the third actor should be focused
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the second actor not focusable
+ Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
+ second.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus backward and check that the second actor should be skipped and
+ // the first actor should be focused now.
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the third actor invisible
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus backward and check that the third actor should be skipped as it's
+ // invisible and the second actor should also be skipped as it's not focusable,
+ // so the focus will still be on the first actor
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the first actor invisible so that no actor can be focused.
+ first.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the focus move is failed as all the three actors can not be focused
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+ END_TEST;
+}
+
+int UtcDaliFocusManagerClearFocus(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerClearFocus");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ // Check that no actor is being focused now.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ END_TEST;
+}
+
+int UtcDaliFocusManagerReset(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerReset");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Clear the focus
+ manager.Reset();
+
+ // Check that no actor is being focused now and the focus order of actors have been cleared
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+ END_TEST;
+}
+
+int UtcDaliFocusManagerFocusGroup(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerFocusGroup");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor with two child actors and add it to the stage
+ Actor parent = Actor::New();
+ Actor firstChild = Actor::New();
+ Actor secondChild = Actor::New();
+ parent.Add(firstChild);
+ parent.Add(secondChild);
+ Stage::GetCurrent().Add(parent);
+
+ // Create three actors and add them as the children of the first child actor
+ Actor firstGrandChild = Actor::New();
+ Actor secondGrandChild = Actor::New();
+ Actor thirdGrandChild = Actor::New();
+ firstChild.Add(firstGrandChild);
+ firstChild.Add(secondGrandChild);
+ firstChild.Add(thirdGrandChild);
+
+ // Set focus order to the actors
+ manager.SetFocusOrder(parent, 1);
+ manager.SetFocusOrder(firstChild, 2);
+ manager.SetFocusOrder(firstGrandChild, 3);
+ manager.SetFocusOrder(secondGrandChild, 4);
+ manager.SetFocusOrder(thirdGrandChild, 5);
+ manager.SetFocusOrder(secondChild, 6);
+
+ // Set the parent and the first child actor as focus groups
+ manager.SetFocusGroup(parent, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
+
+ // The focus group of the parent should be itself, as it is set to be a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(parent) == parent);
+
+ // The focus group of the firstChild should be its parent, as it is the immediate parent which is also a group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == parent);
+
+ manager.SetFocusGroup(firstChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
+
+ // The focus group of the firstChild should be itself, as it is set to be a focus group now.
+ DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == firstChild);
+
+ // Enable wrap mode for focus movement.
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the parent actor.
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(parent) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
+
+ // Check that group mode is disabled.
+ DALI_TEST_CHECK(manager.GetGroupMode() == false);
+
+ // Check that the focus movement is wrapped as normal.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+
+ // Enable the group mode.
+ manager.SetGroupMode(true);
+ DALI_TEST_CHECK(manager.GetGroupMode() == true);
+
+ // Check that the focus movement is now limited to the current focus group.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+ END_TEST;
+}
+
+int UtcDaliFocusManagerSetAndGetFocusIndicator(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSetAndGetFocusIndicator");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
+ DALI_TEST_CHECK(defaultFocusIndicatorActor);
+
+ Actor newFocusIndicatorActor = Actor::New();
+ manager.SetFocusIndicatorActor(newFocusIndicatorActor);
+ DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
+ END_TEST;
+}
+
+int UtcDaliFocusManagerSignalFocusChanged(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSignalFocusChanged");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool signalVerified = false;
+ FocusChangedCallback callback(signalVerified);
+ manager.FocusChangedSignal().Connect( &callback, &FocusChangedCallback::Callback );
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ // Check that no actor is being focused now.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ END_TEST;
+}
+
+int UtcDaliFocusManagerSignalFocusOvershot(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSignalFocusOvershot");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool signalVerified = false;
+ FocusOvershotCallback callback(signalVerified);
+ manager.FocusOvershotSignal().Connect(&callback, &FocusOvershotCallback::Callback);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that the wrap mode is disabled
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is moved to the second actor successfully.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Check that the forward focus movement is overshot.
+ callback.mCurrentFocusedActor = second;
+ callback.mFocusOvershotDirection = Toolkit::FocusManager::OVERSHOT_NEXT;
+ DALI_TEST_CHECK(manager.MoveFocusForward() == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(signalVerified);
+ callback.Reset();
+
+ // Enable the wrap mode
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Check that the forward focus movement is wrapped and no overshot happens.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(signalVerified == false);
+
+ // Disable the wrap mode
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Check that the backward focus movement is overshot.
+ callback.mCurrentFocusedActor = first;
+ callback.mFocusOvershotDirection = Toolkit::FocusManager::OVERSHOT_PREVIOUS;
+ DALI_TEST_CHECK(manager.MoveFocusBackward() == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(signalVerified);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void utc_dali_toolkit_grid_layout_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_grid_layout_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+const unsigned int TOTAL_ITEM_NUMBER = 200;
+
+Vector3 GridLayoutItemSizeFunction(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing)
+{
+ float width = (layoutWidth - sideMargin * 2.0f - columnSpacing * static_cast<float>(numberOfColumns - 1)) / static_cast<float>(numberOfColumns);
+
+ return Vector3(width, width, width);
+}
+
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an test actor for this item
+ ImageActor actor = CreateSolidColorActor(Color::RED);
+ actor.SetSize(64.0f, 64.0f);
+ return actor;
+ }
+};
+
+} // namespace
+
+
+
+int UtcDaliGridLayoutNew(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ DALI_TEST_CHECK(gridLayout);
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetNumberOfColumns(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the number of columns
+ gridLayout->SetNumberOfColumns(6);
+
+ // Check whether we get the correct number of columns
+ DALI_TEST_CHECK(gridLayout->GetNumberOfColumns() == 6);
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetRowSpacing(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the row spacing
+ gridLayout->SetRowSpacing(10.0f);
+
+ // Check whether we get the correct row spacing
+ DALI_TEST_EQUALS(gridLayout->GetRowSpacing(), 10.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetColumnSpacing(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the column spacing
+ gridLayout->SetColumnSpacing(10.0f);
+
+ // Check whether we get the correct column spacing
+ DALI_TEST_EQUALS(gridLayout->GetColumnSpacing(), 10.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetTopMargin(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the top margin
+ gridLayout->SetTopMargin(30.0f);
+
+ // Check whether we get the correct top margin
+ DALI_TEST_EQUALS(gridLayout->GetTopMargin(), 30.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetBottomMargin(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the bottom margin
+ gridLayout->SetBottomMargin(30.0f);
+
+ // Check whether we get the correct bottom margin
+ DALI_TEST_EQUALS(gridLayout->GetBottomMargin(), 30.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetSideMargin(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the side margin
+ gridLayout->SetSideMargin(10.0f);
+
+ // Check whether we get the correct side margin
+ DALI_TEST_EQUALS(gridLayout->GetSideMargin(), 10.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetZGap(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the gap of items in the Z axis in different columns
+ gridLayout->SetZGap(5.0f);
+
+ // Check whether we get the correct Z gap
+ DALI_TEST_EQUALS(gridLayout->GetZGap(), 5.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetItemSizeFunction(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the item size function
+ gridLayout->SetItemSizeFunction(GridLayoutItemSizeFunction);
+
+ // Check whether we get the correct item size function
+ DALI_TEST_CHECK(gridLayout->GetItemSizeFunction() == GridLayoutItemSizeFunction);
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetScrollSpeedFactor(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the scroll speed factor
+ gridLayout->SetScrollSpeedFactor(0.05f);
+
+ // Check whether we get the correct scroll speed factor
+ DALI_TEST_EQUALS(gridLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the maximum swipe speed
+ gridLayout->SetMaximumSwipeSpeed(50.0f);
+
+ // Check whether we get the correct maximum swipe speed
+ DALI_TEST_EQUALS(gridLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration(void)
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the flick animaiton duration
+ gridLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( gridLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliGridLayoutConstraintLeft(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliGridLayoutConstraintRight(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliGridLayoutConstraintUp(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+
+ ItemLayoutPtr layout = gridLayout;
+ layout->GetClosestOnScreenLayoutPosition(0, 0.0f, vec);
+ int nextItem = layout->GetNextFocusItemID(0, 10, Dali::Toolkit::Control::Right, false);
+ DALI_TEST_CHECK(nextItem == 1);
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliGridLayoutConstraintDown(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliGridLayoutScrollDirection(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ ItemLayoutPtr layout = gridLayout;
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ gridLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ Degree deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 0.0f);
+
+ gridLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK((deg == 180.0f));
+
+ layout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 90.f);
+
+ gridLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 270.0f);
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+void utc_dali_toolkit_iris_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_iris_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliIrisEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::IrisEffect effect;
+
+ try
+ {
+ // New() must be called to create a IrisEffect or it wont be valid.
+ effect.SetRadius( 2.0f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliIrisEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::IrisEffect effect = Toolkit::IrisEffect::New();
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetBlendFactorPropertyName(), "uBlendFactor", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliIrisEffectDefaultValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::IrisEffect effect = Toolkit::IrisEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ const float radiusValue(0.0f);
+ const Vector2 centerValue(0.5f, 0.5f);
+ const float blendFactorValue(100.0f);
+
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetBlendFactorPropertyName().c_str(), blendFactorValue ) );
+ END_TEST;
+}
+
+int UtcDaliIrisEffectCustomValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::IrisEffect effect = Toolkit::IrisEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ const float radiusValue(23.0f);
+ const Vector2 centerValue(0.2f, 0.7f);
+ const float blendFactorValue(10.0f);
+
+ effect.SetRadius( radiusValue );
+ effect.SetCenter( centerValue );
+ effect.SetBlendFactor( blendFactorValue );
+
+ actor.SetShaderEffect(effect);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) );
+ DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetBlendFactorPropertyName().c_str(), blendFactorValue ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 200;
+const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
+
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an image actor for this item
+ Image image = Image::New( TEST_IMAGE_FILE_NAME );
+ Actor actor = ImageActor::New(image);
+
+ return actor;
+ }
+};
+} // namespace
+
+int UtcDaliItemLayoutSetAndGetOrientation(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Set the orientation of the layout to be horizontal from left to right
+ ItemLayoutPtr layout = view.GetLayout(0);
+ layout->SetOrientation(ControlOrientation::Left);
+
+ // Check the orientation of the layout is horizontal from left to right
+ DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left);
+ END_TEST;
+}
+
+int UtcDaliItemLayoutGetScrollHints(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Set the orientation of the layout to be horizontal from left to right
+ ItemLayoutPtr layout = view.GetLayout(0);
+
+ Vector2 axisScrollHint;
+
+ layout->SetOrientation(ControlOrientation::Up);
+ layout->GetXAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ layout->GetYAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+ layout->SetOrientation(ControlOrientation::Down);
+ layout->GetXAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ layout->GetYAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+ layout->SetOrientation(ControlOrientation::Left);
+ layout->GetXAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ layout->GetYAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+ layout->SetOrientation(ControlOrientation::Right);
+ layout->GetXAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ layout->GetYAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+#include <float.h> // for FLT_MAX
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void utc_dali_toolkit_item_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_item_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 100;
+const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an image actor for this item
+ Image image = Image::New( TEST_IMAGE_FILE_NAME );
+ Actor actor = ImageActor::New(image);
+
+ return actor;
+ }
+};
+
+} // namespace
+
+
+int UtcDaliItemViewNew(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ DALI_TEST_CHECK(view);
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliItemViewDownCast(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ const ItemView itemViewConst = ItemView::New(factory);
+ ItemView itemView(itemViewConst);
+
+ BaseHandle handle(itemView);
+
+ ItemView newItemView = ItemView::DownCast( handle );
+ DALI_TEST_CHECK( itemView );
+ DALI_TEST_CHECK( newItemView == itemView );
+ END_TEST;
+}
+
+int UtcDaliItemViewAddAndGetLayout(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // As we have added one layout, check the number of layout is now 1
+ DALI_TEST_CHECK(view.GetLayoutCount() == 1);
+
+
+ // Check we are getting the correct layout from ItemView
+ DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
+ END_TEST;
+}
+
+int UtcDaliItemViewAddAndRemoveLayout(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // As we have added one layout, check the number of layout is now 1
+ DALI_TEST_CHECK(view.GetLayoutCount() == 1);
+
+ // Check we are getting the correct layout from ItemView
+ DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
+
+ // Remove the grid layout
+ view.RemoveLayout(0);
+
+ // As we have removed the grid layout, check the number of layout is now 0
+ DALI_TEST_CHECK(view.GetLayoutCount() == 0);
+
+ END_TEST;
+}
+
+int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ DALI_TEST_CHECK(view.GetLayoutCount() == 1);
+
+ // Check there is no active layout at the moment
+ DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
+
+ // Activate the grid layout
+ Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+
+ // Check the current active layout is the grid layout
+ DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
+
+ END_TEST;
+}
+
+int UtcDaliItemViewDeactivateCurrentLayout(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Check there is no active layout at the moment
+ DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
+
+ // Activate the grid layout
+ Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+
+ // Check the current active layout is the grid layout
+ DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
+
+ // Deactivate the current layout
+ view.DeactivateCurrentLayout();
+
+ // Check there is no active layout at the moment
+ DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
+ END_TEST;
+}
+
+int UtcDaliItemViewGetItemAndGetItemId(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Activate the grid layout so that the items will be created and added to ItemView
+ Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+
+ // Get the item given the item ID
+ Actor itemActor = view.GetItem(2);
+
+ // Check we are getting the correct Item ID given the specified actor
+ DALI_TEST_CHECK(view.GetItemId(itemActor) == 2);
+ END_TEST;
+}
+
+int UtcDaliItemViewRemoveItem(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Activate the grid layout so that the items will be created and added to ItemView
+ Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+
+ // Get the item given the item ID 2 and 3
+ Actor oldItemActorID2 = view.GetItem(2);
+ Actor oldItemActorID3 = view.GetItem(3);
+
+ // Remove the item with ID 2
+ view.RemoveItem(2, 0.0f);
+
+ // Get the new item given the item ID 2
+ Actor newItemActorID2 = view.GetItem(2);
+
+ // Check the original item with item ID 2 was deleted and now item ID 2 represents the original item with ID 3
+ DALI_TEST_CHECK(view.GetItemId(newItemActorID2) == 2);
+ DALI_TEST_CHECK(oldItemActorID2 != newItemActorID2);
+ DALI_TEST_CHECK(newItemActorID2 = oldItemActorID3);
+ END_TEST;
+}
+
+int UtcDaliItemViewGetCurrentLayoutPosition(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Activate the grid layout so that the items will be created and added to ItemView
+ Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+ view.ActivateLayout(0, stageSize, 0.0f);
+
+ // Check the current layout position for the 10th items is 9.0f
+ DALI_TEST_EQUALS(view.GetCurrentLayoutPosition(9), 9.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliItemViewSetAndGetMinimumSwipeSpeed(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Set the minimum swipe speed to be 1.5f
+ view.SetMinimumSwipeSpeed(1.5f);
+
+ // Check the minimum swipe speed is 1.5f
+ DALI_TEST_EQUALS(view.GetMinimumSwipeSpeed(), 1.5f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliItemViewSetAndGetMinimumSwipeDistance(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Set the minimum swipe distance to be 2.5f
+ view.SetMinimumSwipeDistance(2.5f);
+
+ // Check the minimum swipe distance is 2.5f
+ DALI_TEST_EQUALS(view.GetMinimumSwipeDistance(), 2.5f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliItemViewSetAndGetAnchoring(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Disable the anchor animation
+ view.SetAnchoring(false);
+
+ // Check the anchor animation is disabled
+ DALI_TEST_CHECK(view.GetAnchoring() == false);
+ END_TEST;
+}
+
+int UtcDaliItemViewSetAndGetAnchoringDuration(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Set the duration of anchor animation to be 1.5f
+ view.SetAnchoringDuration(1.5f);
+
+ // Check the duration of anchor animation is 1.5f
+ DALI_TEST_EQUALS(view.GetAnchoringDuration(), 1.5f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliItemViewSetAndGetRefreshInterval(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Set the interval between refreshes to be 20
+ view.SetRefreshInterval(20);
+
+ // Check the interval between refreshes is 20
+ DALI_TEST_CHECK(view.GetRefreshInterval() == 20);
+ END_TEST;
+}
+
+int UtcDaliItemViewScrollToItem(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr layout = GridLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view.
+ std::vector<unsigned int> indices;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ indices.push_back(i);
+ }
+ }
+
+ try
+ {
+ if (!indices.empty())
+ {
+ const unsigned int firstTargetIndex = indices[indices.size()-1];
+ // scroll to last item
+ view.ScrollToItem(firstTargetIndex, 0.00f);
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ std::size_t moveCount = 0;
+ for(std::size_t i = 0; i < indices.size(); i++)
+ {
+ float layoutPosBefore = view.GetCurrentLayoutPosition(i);
+ view.ScrollToItem(indices[i], 0.0f);
+ float layoutPosAfter = view.GetCurrentLayoutPosition(i);
+
+ if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
+ {
+ ++moveCount;
+ }
+ }
+
+ DALI_TEST_CHECK((moveCount == indices.size()));
+ }
+ }
+ catch(...)
+ {
+ tet_result(TET_FAIL);
+ }
+
+ Stage::GetCurrent().Remove(view);
+ END_TEST;
+}
+
+int UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Set the scroll distance step for the mouse wheel event to be 100.0f
+ view.SetMouseWheelScrollDistanceStep(100.0f);
+
+ // Check the scroll distance step is 100.0f
+ DALI_TEST_EQUALS(view.GetMouseWheelScrollDistanceStep(), 100.0f, TEST_LOCATION );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/key-event-integ.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void utc_dali_toolkit_keyboard_focus_manager_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_keyboard_focus_manager_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+// Functors to test whether PreFocusChange signal is emitted when the keyboard focus is about to change
+class PreFocusChangeCallback : public Dali::ConnectionTracker
+{
+public:
+ PreFocusChangeCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mProposedActorToFocus(),
+ mDirection(Control::Left)
+ {
+ }
+
+ Actor Callback(Actor currentFocusedActor, Actor proposedActorToFocus, Control::KeyboardFocusNavigationDirection direction)
+ {
+ tet_infoline("Verifying PreFocusChangeCallback()");
+
+ mSignalVerified = true;
+
+ mCurrentFocusedActor = currentFocusedActor;
+ mProposedActorToFocus = proposedActorToFocus;
+ mDirection = direction;
+
+ return mProposedActorToFocus;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ mCurrentFocusedActor = Actor();
+ mProposedActorToFocus = Actor();
+ mDirection = Control::Left;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ Actor mProposedActorToFocus;
+ Control::KeyboardFocusNavigationDirection mDirection;
+};
+
+// Functors to test whether focus changed signal is emitted when the keyboard focus is changed
+class FocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mOriginalFocusedActor(),
+ mCurrentFocusedActor()
+ {
+ }
+
+ void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
+ {
+ tet_infoline("Verifying FocusChangedCallback()");
+
+ if(originalFocusedActor == mCurrentFocusedActor)
+ {
+ mSignalVerified = true;
+ }
+
+ mOriginalFocusedActor = originalFocusedActor;
+ mCurrentFocusedActor = currentFocusedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mOriginalFocusedActor;
+ Actor mCurrentFocusedActor;
+};
+
+// Functors to test whether focus group changed signal is emitted when the keyboard focus group is changed
+class FocusGroupChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusGroupChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mForward(true)
+ {
+ }
+
+ void Callback(Actor currentFocusedActor, bool forward)
+ {
+ tet_infoline("Verifying FocusGroupChangedCallback()");
+
+ mSignalVerified = true;
+
+ mCurrentFocusedActor = currentFocusedActor;
+ mForward = forward;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ bool mForward;
+};
+
+// Functors to test whether focused actor activated signal is emitted when the focused actor is activated
+class FocusedActorActivatedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusedActorActivatedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mActivatedActor()
+ {
+ }
+
+ void Callback(Actor activatedActor)
+ {
+ tet_infoline("Verifying FocusedActorActivatedCallback()");
+
+ mSignalVerified = true;
+
+ mActivatedActor = activatedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mActivatedActor;
+};
+
+} // namespace
+
+
+int UtcDaliKeyboardFocusManagerGet(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardKeyboardFocusManagerGet");
+
+ KeyboardFocusManager manager;
+
+ manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ KeyboardFocusManager newManager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(newManager);
+
+ // Check that focus manager is a singleton
+ DALI_TEST_CHECK(manager == newManager);
+ END_TEST;
+}
+
+int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ first.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ second.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(second);
+
+ // Create the third actor but don't add it to the stage
+ Actor third = Actor::New();
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that it will fail to set focus on an invalid actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Check that it will fail to set focus on the third actor as it's not in the stage
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Add the third actor to the stage
+ Stage::GetCurrent().Add(third);
+
+ // Check that it will fail to set focus on the third actor as it's not focusable
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Make the third actor focusable
+ third.SetKeyboardFocusable(true);
+
+ // Check that the focus is successfully moved to the third actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ END_TEST;
+}
+
+int UtcDaliKeyboardFocusManagerMoveFocus(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocus");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool preFocusChangeSignalVerified = false;
+ PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified);
+ manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
+
+ bool focusChangedSignalVerified = false;
+ FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
+ manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ first.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ second.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(second);
+
+ // Move the focus to the right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false);
+
+ // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right);
+ preFocusChangeCallback.Reset();
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false);
+
+ // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right);
+ preFocusChangeCallback.Reset();
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards up
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Up) == false);
+
+ // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Up);
+ preFocusChangeCallback.Reset();
+ DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
+
+ END_TEST;
+}
+
+int UtcDaliKeyboardFocusManagerClearFocus(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerClearFocus");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ first.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ second.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(second);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ // Check that no actor is being focused now.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ END_TEST;
+}
+
+int UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Check that the focus movement is not looped within the same focus group by default
+ DALI_TEST_CHECK(manager.GetFocusGroupLoop() == false);
+
+ // Enable the loop
+ manager.SetFocusGroupLoop(true);
+ DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
+ END_TEST;
+}
+
+int UtcDaliKeyboardFocusManagerSetAsFocusGroup(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSetAsFocusGroup");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor and check that it is not a focus group by default
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false);
+
+ // Set the actor as focus group
+ manager.SetAsFocusGroup(actor, true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(actor) == true);
+
+ // Set the actor not as focus group
+ manager.SetAsFocusGroup(actor, false);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false);
+ END_TEST;
+}
+
+int UtcDaliKeyboardFocusManagerGetFocusGroup(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerGetFocusGroup");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor with two child actors and add it to the stage
+ Actor parent = Actor::New();
+ Actor child = Actor::New();
+ parent.Add(child);
+ Stage::GetCurrent().Add(parent);
+
+ // Create three actors and add them as the children of the first child actor
+ Actor grandChild = Actor::New();
+ child.Add(grandChild);
+
+ // Set the parent and the first child actor as focus groups
+ manager.SetAsFocusGroup(parent, true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
+
+ // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == parent);
+
+ manager.SetAsFocusGroup(child, true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(child) == true);
+
+ // The focus group should be the child, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == child);
+
+ manager.SetAsFocusGroup(grandChild, true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(grandChild) == true);
+
+ // The current focus group should be itself, As it is also a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == grandChild);
+ END_TEST;
+}
+
+int UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
+ DALI_TEST_CHECK(defaultFocusIndicatorActor);
+
+ Actor newFocusIndicatorActor = Actor::New();
+ manager.SetFocusIndicatorActor(newFocusIndicatorActor);
+ DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
+ END_TEST;
+}
+
+
+int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusedActorActivated");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool focusedActorActivatedSignalVerified = false;
+ FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified);
+ manager.FocusedActorActivatedSignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
+
+ Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
+
+ // Create the first button and add it to the stage
+ PushButton firstPushButton = PushButton::New();
+ firstPushButton.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(firstPushButton);
+
+ // Create the second button and add it to the stage
+ PushButton secondPushButton = PushButton::New();
+ secondPushButton.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(secondPushButton);
+
+ // Check that the focus is set on the first button
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstPushButton) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstPushButton);
+
+ // Send the return event to activate the first button
+ application.ProcessEvent(returnEvent);
+ DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == firstPushButton);
+ focusedActorActivatedCallback.Reset();
+
+ // Check that the focus is set on the second button
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondPushButton) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondPushButton);
+
+ // Send the return event again to activate the second button
+ application.ProcessEvent(returnEvent);
+ DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == secondPushButton);
+ focusedActorActivatedCallback.Reset();
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+void utc_dali_toolkit_markup_processor_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_markup_processor_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+struct MarkupStringTest
+{
+ std::string input;
+ std::string expectedResult;
+};
+
+bool TestMarkupString( const std::string& input, const std::string& expectedResult, std::string& result )
+{
+ Toolkit::MarkupProcessor::StyledTextArray styledTextArray;
+
+ GetStyledTextArray( input, styledTextArray, true );
+ GetMarkupString( styledTextArray, result );
+
+ return expectedResult == result;
+}
+
+} // namespace
+
+
+// Positive test case for a method
+int UtcDaliMarkupProcessor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliMarkupProcessor ");
+
+ const std::string text1( "Text" );
+ const std::string text2( "< font face ='FreeSerif' color= 'green' >t< / font >" );
+ const std::string text3( "< font face = 'FreeSerif' size= '16' style = 'Bold' color='red'>< i><u >Styled< / u> Text< /i >< / font >< br / >" );
+ const std::string text4( "<font face='FreeSerif' size='14' color='0xaadd8744'><b><u>Styled</u> Te<font size='20'>x</font>t</b></font>< br/>" );
+ const std::string text5( "< shadow color = 'blue' paramx = '1' paramy = '0.75' >Shadow< / shadow><br />" );
+ const std::string text6( "<smooth param= '0.75' >< glow color = 'red' param = '0.1' >Glow</glow></smooth>< br />" );
+ const std::string text7( "<font color='green''>< outline color = 'red' paramx = '0.7' paramy = '0.7' >Outline< / outline >< /font >< br / >" );
+ const std::string text8( "<smooth param='0.75'>Smooth</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( "<font face='FreeSerif' color='green'>t</font>" );
+ const std::string result3( "<font face='FreeSerif' style='Bold' size='16' color='red'><i><u>Styled</u></i></font><font face='FreeSerif' style='Bold' size='16' color='red'><i> Text</i></font><br />" );
+ const std::string result4( "<font face='FreeSerif' size='14' color='0xaadd8744'><b><u>Styled</u></b></font><font face='FreeSerif' size='14' color='0xaadd8744'><b> Te</b></font><font face='FreeSerif' size='20' color='0xaadd8744'><b>x</b></font><font face='FreeSerif' size='14' color='0xaadd8744'><b>t</b></font><br />" );
+ const std::string result5( "<shadow color='blue' paramx='1' paramy='0.75'>Shadow</shadow><br />" );
+ const std::string result6( "<smooth param='0.75'><glow color='red' param='0.1'>Glow</glow></smooth><br />" );
+ const std::string result7( "<font color='green'><outline color='red' paramx='0.7' paramy='0.7'>Outline</outline></font><br />" );
+ const std::string result8( "<smooth param='0.75'>Smooth</smooth><br />" );
+ const std::string result9( text9 );
+ const std::string result10( text10 );
+ const std::string result11( "<br />" );
+
+ std::string markupString;
+ Toolkit::MarkupProcessor::StyledTextArray styledTextArray;
+
+ GetStyledTextArray( text1, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result1, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text2, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result2, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text3, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result3, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text4, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result4, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text5, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result5, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text6, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result6, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text7, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result7, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text8, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result8, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text9, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+ DALI_TEST_EQUALS( result9, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text10, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+
+ DALI_TEST_EQUALS( result10, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text11, styledTextArray, true );
+ GetMarkupString( styledTextArray, markupString );
+
+ DALI_TEST_EQUALS( result11, markupString, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliMarkupProcessorSetTextStyle01(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliMarkupProcessorSetTextStyle01 ");
+
+ const std::string text1( "Text with no defined style" );
+ const std::string result1( "<font color='green'><i>Text with no defined style</i></font>" );
+ const std::string result2( "Text with <font color='green'><i>no defined</i></font> style" );
+
+ std::string markupString;
+ Toolkit::MarkupProcessor::StyledTextArray styledTextArray;
+
+ GetStyledTextArray( text1, styledTextArray, true );
+
+ TextStyle style;
+ style.SetItalics( true );
+ style.SetTextColor( Color::GREEN );
+
+ SetTextStyle( styledTextArray, style );
+ GetMarkupString( styledTextArray, markupString );
+
+ DALI_TEST_EQUALS( result1, markupString, TEST_LOCATION );
+
+ styledTextArray.clear();
+ SetTextStyle( text1, styledTextArray, style );
+ GetMarkupString( styledTextArray, markupString );
+
+ DALI_TEST_EQUALS( result1, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text1, styledTextArray, true );
+ SetTextStyleToRange( styledTextArray, style, TextStyle::ALL, 0, text1.size() - 1 );
+ GetMarkupString( styledTextArray, markupString );
+
+ DALI_TEST_EQUALS( result1, markupString, TEST_LOCATION );
+
+ GetStyledTextArray( text1, styledTextArray, true );
+ SetTextStyleToRange( styledTextArray, style, TextStyle::ALL, 10, 19 );
+ GetMarkupString( styledTextArray, markupString );
+
+ DALI_TEST_EQUALS( result2, markupString, TEST_LOCATION );
+
+ std::string plainString;
+ GetPlainString( styledTextArray, plainString );
+
+ DALI_TEST_EQUALS( text1, plainString, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliMarkupProcessorSetTextStyle02(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliMarkupProcessorSetTextStyle02 ");
+
+ Toolkit::MarkupProcessor::StyledTextArray styledTextArray;
+
+ // Test style applied to and empty string doesn't crash
+
+ TextStyle style;
+ style.SetItalics( true );
+ style.SetTextColor( Color::GREEN );
+
+ bool fails = false;
+ try
+ {
+ SetTextStyle( styledTextArray, style );
+ }
+ catch( ... )
+ {
+ fails = true;
+ }
+
+ DALI_TEST_CHECK( !fails );
+ END_TEST;
+}
+
+int UtcDaliMarkupProcessorTestColors(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliMarkupProcessorTestColors ");
+
+ struct MarkupStringTest colorTests[] =
+ {
+ {
+ std::string( "<font color='0xFF000000'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='0xFFFFFFFF'>white</font>" ),
+ std::string( "white" )
+ },
+ {
+ std::string( "<font color='0xFFFF0000'>red</font>" ),
+ std::string( "<font color='red'>red</font>" )
+ },
+ {
+ std::string( "<font color='0xFF00FF00'>green</font>" ),
+ std::string( "<font color='green'>green</font>" )
+ },
+ {
+ std::string( "<font color='0xFF0000FF'>blue</font>" ),
+ std::string( "<font color='blue'>blue</font>" )
+ },
+ {
+ std::string( "<font color='0xFFFFFF00'>yellow</font>" ),
+ std::string( "<font color='yellow'>yellow</font>" )
+ },
+ {
+ std::string( "<font color='0xFFFF00FF'>magenta</font>" ),
+ std::string( "<font color='magenta'>magenta</font>" )
+ },
+ {
+ std::string( "<font color='0xFF00FFFF'>cyan</font>" ),
+ std::string( "<font color='cyan'>cyan</font>" )
+ },
+ {
+ std::string( "<font color='0x00000000'>transparent</font>" ),
+ std::string( "<font color='transparent'>transparent</font>" )
+ },
+ {
+ std::string( "<font color='#000000'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='#FFFFFF'>white</font>" ),
+ std::string( "white" )
+ },
+ {
+ std::string( "<font color='#FF0000'>red</font>" ),
+ std::string( "<font color='red'>red</font>" )
+ },
+ {
+ std::string( "<font color='#00FF00'>green</font>" ),
+ std::string( "<font color='green'>green</font>" )
+ },
+ {
+ std::string( "<font color='#0000FF'>blue</font>" ),
+ std::string( "<font color='blue'>blue</font>" )
+ },
+ {
+ std::string( "<font color='#FFFF00'>yellow</font>" ),
+ std::string( "<font color='yellow'>yellow</font>" )
+ },
+ {
+ std::string( "<font color='#FF00FF'>magenta</font>" ),
+ std::string( "<font color='magenta'>magenta</font>" )
+ },
+ {
+ std::string( "<font color='#00FFFF'>cyan</font>" ),
+ std::string( "<font color='cyan'>cyan</font>" )
+ },
+ {
+ std::string( "<font color='#000'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='#FFF'>white</font>" ),
+ std::string( "white" )
+ },
+ {
+ std::string( "<font color='#F00'>red</font>" ),
+ std::string( "<font color='red'>red</font>" )
+ },
+ {
+ std::string( "<font color='#0F0'>green</font>" ),
+ std::string( "<font color='green'>green</font>" )
+ },
+ {
+ std::string( "<font color='#00F'>blue</font>" ),
+ std::string( "<font color='blue'>blue</font>" )
+ },
+ {
+ std::string( "<font color='#FF0'>yellow</font>" ),
+ std::string( "<font color='yellow'>yellow</font>" )
+ },
+ {
+ std::string( "<font color='#F0F'>magenta</font>" ),
+ std::string( "<font color='magenta'>magenta</font>" )
+ },
+ {
+ std::string( "<font color='#0FF'>cyan</font>" ),
+ std::string( "<font color='cyan'>cyan</font>" )
+ },
+ {
+ std::string( "<font color='0x000000'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='black'>black</font>" ),
+ std::string( "<font color='black'>black</font>" )
+ },
+ {
+ std::string( "<font color='white'>white</font>" ),
+ std::string( "white" )
+ },
+ {
+ std::string( "<font color='red'>red</font>" ),
+ std::string( "<font color='red'>red</font>" )
+ },
+ {
+ std::string( "<font color='0xFF00FF00'>green</font>" ),
+ std::string( "<font color='green'>green</font>" )
+ },
+ {
+ std::string( "<font color='blue'>blue</font>" ),
+ std::string( "<font color='blue'>blue</font>" )
+ },
+ {
+ std::string( "<font color='yellow'>yellow</font>" ),
+ std::string( "<font color='yellow'>yellow</font>" )
+ },
+ {
+ std::string( "<font color='magenta'>magenta</font>" ),
+ std::string( "<font color='magenta'>magenta</font>" )
+ },
+ {
+ std::string( "<font color='cyan'>cyan</font>" ),
+ std::string( "<font color='cyan'>cyan</font>" )
+ },
+ {
+ std::string( "<font color='transparent'>transparent</font>" ),
+ std::string( "<font color='transparent'>transparent</font>" )
+ },
+ {
+ std::string( "<outline color='white'>outline</outline>" ),
+ std::string( "<outline color='white'>outline</outline>" )
+ },
+ };
+
+ const std::size_t numberOfTests( 36 );
+
+ bool fails = false;
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const MarkupStringTest& test = colorTests[index];
+
+ std::string result;
+ if( !TestMarkupString( test.input, test.expectedResult, result ) )
+ {
+ TestMarkupString( test.input, test.expectedResult, result );
+ tet_printf( "%s\n input : %s\nexpected result : %s\n result : %s\n", TEST_LOCATION, test.input.c_str(), test.expectedResult.c_str(), result.c_str() );
+
+ fails = true;
+ }
+ }
+
+ DALI_TEST_CHECK( !fails );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+void utc_dali_toolkit_mask_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_mask_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliMaskEffectCreateEffect(void)
+{
+ ToolkitTestApplication application;
+
+ BitmapImage image = CreateBitmapImage();
+
+ ShaderEffect effect = Toolkit::MaskEffect::New( image );
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+int UtcDaliMaskEffectDestructor(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::MaskEffect* effect = new Toolkit::MaskEffect();
+ delete effect;
+
+ DALI_TEST_CHECK( true );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+void utc_dali_toolkit_nine_patch_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_nine_patch_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliNinePatchMaskEffectApply(void)
+{
+ ToolkitTestApplication application;
+
+ BitmapImage image = CreateBitmapImage();
+ ImageActor actor0 = ImageActor::New( image );
+ Toolkit::NinePatchMaskEffect::Apply( actor0, "" );
+
+ Stage::GetCurrent().Add( actor0 );
+
+ application.SendNotification(); // Force usage of constraint
+ application.Render();
+
+ DALI_TEST_CHECK( actor0.GetStyle() == ImageActor::STYLE_NINE_PATCH );
+
+ ImageActor actor1 = ImageActor::New( image );
+ Vector4 border( 0, 0, 0, 0 );
+ Toolkit::NinePatchMaskEffect::Apply( actor1, "", border );
+
+ Stage::GetCurrent().Add( actor1 );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( actor1.GetStyle() == ImageActor::STYLE_NINE_PATCH );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void utc_dali_toolkit_popup_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_popup_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+const int RENDER_FRAME_INTERVAL = 10; ///< Duration of each frame in ms.
+const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation
+const int RENDER_ANIMATION_TEST_DURATION_FRAMES = RENDER_ANIMATION_TEST_DURATION_MS / RENDER_FRAME_INTERVAL; ///< equivalent frames.
+const Vector3 DEFAULT_BUTTON_SIZE(100.0f, 50.0f, 0.0f);
+const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10.0f, 10.0f );
+const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10.0f, 10.0f );
+
+/**
+ * Counts how many descendents root Actor has, including
+ * itself.
+ *
+ * @param[in] root The root actor to count from.
+ * @return The number of descendents including root actor itself.
+ */
+int DescendentCount(const Actor& root)
+{
+ unsigned int numChildren = root.GetChildCount();
+
+ int count = 1;
+
+ for(unsigned int i=0; i<numChildren; ++i)
+ {
+ count += DescendentCount(root.GetChildAt(i));
+ }
+
+ return count;
+}
+
+bool HasAncestor(Actor child, Actor ancestor)
+{
+ while(child && child != ancestor)
+ {
+ child = child.GetParent();
+ }
+
+ return (child == ancestor);
+}
+
+
+static bool gHidden = false;
+
+static void OnPopupHidden()
+{
+ gHidden = true;
+}
+
+static bool gTouchedOutside;
+
+static void OnPopupTouchedOutside()
+{
+ gTouchedOutside = true;
+}
+
+
+} // anon namespace
+
+int UtcDaliPopupNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPopupNew");
+
+ // Create the Popup actor
+ Popup popup;
+
+ DALI_TEST_CHECK( !popup );
+
+ popup = Popup::New();
+
+ DALI_TEST_CHECK( popup );
+
+ Popup popup2(popup);
+
+ DALI_TEST_CHECK( popup2 == popup );
+
+ //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 );
+ {
+ Popup popup = Popup::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliPopupDestructor(void)
+{
+ ToolkitTestApplication application;
+
+ Popup* popup = new Popup();
+ delete popup;
+
+ DALI_TEST_CHECK( true );
+ END_TEST;
+}
+
+int UtcDaliPopupDownCast(void)
+{
+ ToolkitTestApplication application;
+
+ Handle handle = Popup::New();
+
+ Popup popup = Popup::DownCast( handle );
+
+ DALI_TEST_CHECK( popup == handle );
+ END_TEST;
+}
+
+int UtcDaliPopoupSetProperty(void)
+{
+ tet_infoline("UtcDaliPopoupSetProperty: ");
+ ToolkitTestApplication application;
+
+ Popup popup = Popup::New();
+
+ //Test properties
+ std::string testString = "Hello World";
+ popup.SetProperty(popup.GetPropertyIndex("title"), testString);
+ DALI_TEST_EQUALS( testString, popup.GetTitle().GetText(), TEST_LOCATION );
+ END_TEST;
+}
+
+
+int UtcDaliPopupSetBackgroundImage(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetBackgroundImage");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+
+ ImageActor image = CreateSolidColorActor( Color::RED );
+ DALI_TEST_CHECK( !image.GetParent() );
+ popup.SetBackgroundImage(image);
+ DALI_TEST_CHECK( image.GetParent() );
+ END_TEST;
+}
+
+int UtcDaliPopupSetTitle(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetTitle");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ // Put in show state so it's layer is connected to popup (for ancestor check).
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+
+ TextView titleActor = TextView::New();
+ titleActor.SetText("title");
+
+ DALI_TEST_CHECK( !popup.GetTitle() );
+ popup.SetTitle(titleActor);
+ DALI_TEST_CHECK( popup.GetTitle() == titleActor );
+ DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "title") );
+ // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
+ DALI_TEST_CHECK( HasAncestor(titleActor, popup) );
+
+ TextView titleActor2 = TextView::New();
+ titleActor2.SetText("anothertitle");
+ popup.SetTitle(titleActor2);
+ DALI_TEST_CHECK( popup.GetTitle() != titleActor );
+ DALI_TEST_CHECK( popup.GetTitle() == titleActor2 );
+ DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "anothertitle") );
+ // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
+ DALI_TEST_CHECK( HasAncestor(titleActor2, popup) );
+ END_TEST;
+}
+
+int UtcDaliPopupSetTitleText(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetTitleText");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ // Put in show state so it's layer is connected to popup (for ancestor check).
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+
+ TextView titleActor = TextView::New();
+ titleActor.SetText("title");
+
+ DALI_TEST_CHECK( !popup.GetTitle() );
+ popup.SetTitle(titleActor);
+ DALI_TEST_CHECK( popup.GetTitle() == titleActor );
+ DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "title") );
+ // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
+ DALI_TEST_CHECK( HasAncestor(titleActor, popup) );
+
+ // this text should replace titleImage actor.
+ popup.SetTitle("newtext");
+ DALI_TEST_CHECK( popup.GetTitle() != titleActor );
+ DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "newtext") );
+ // verify titleActor is no longer inside popup. (been displaced by newtext actor)
+ DALI_TEST_CHECK( !HasAncestor(titleActor, popup) );
+ END_TEST;
+}
+
+int UtcDaliPopupAddButton(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupAddButton");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ // Put in show state so it's layer is connected to popup (for ancestor check).
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+
+ PushButton button = PushButton::New();
+ DALI_TEST_CHECK( !HasAncestor(button, popup) );
+ popup.AddButton(button);
+ // Hide and then re-show popup to cause button to be rearranged and added to popup.
+ popup.SetState( Popup::POPUP_HIDE, 0.0f );
+ popup.SetState( Popup::POPUP_SHOW, 0.0f );
+ DALI_TEST_CHECK( HasAncestor(button, popup) );
+ END_TEST;
+}
+
+int UtcDaliPopupSetState(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetState");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+
+ ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
+ popup.SetBackgroundImage(backgroundImage);
+
+ // Showing/Hiding popup, results in all child Actors being
+ // connected/disconnected from the stage.
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+ DALI_TEST_CHECK( backgroundImage.OnStage() );
+ DALI_TEST_EQUALS( Popup::POPUP_SHOW, popup.GetState(), TEST_LOCATION );
+ popup.SetState(Popup::POPUP_HIDE, 0.0f);
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ DALI_TEST_EQUALS( Popup::POPUP_HIDE, popup.GetState(), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliPopupSetStateSlow(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupSetStateSlow");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+
+ ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
+ popup.SetBackgroundImage(backgroundImage);
+
+ // Showing/Hiding popup, results in all child Actors being
+ // connected/disconnected from the stage.
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+ DALI_TEST_CHECK( backgroundImage.OnStage() );
+
+ // Hide slowly
+ popup.SetState(Popup::POPUP_HIDE);
+
+ // Wait for a while (allow animation to complete), and then check state.
+ for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ }
+
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ END_TEST;
+}
+
+
+
+int UtcDaliPopupShowHide(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupShowHide");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ popup.HiddenSignal().Connect( &OnPopupHidden );
+
+ ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
+ popup.SetBackgroundImage(backgroundImage);
+
+ PushButton button1 = PushButton::New();
+ PushButton button2 = PushButton::New();
+ button1.SetSize(DEFAULT_BUTTON_SIZE);
+ popup.AddButton(button1);
+ button2.SetSize(DEFAULT_BUTTON_SIZE);
+ popup.AddButton(button2);
+
+ // Showing/Hiding popup, results in all child Actors being
+ // connected/disconnected from the stage.
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+
+ // Show
+ // Note: in most popup animation implementations show would result in
+ // popup being onstage immediately following Show(). However we can't
+ // assume for all. e.g. If one creates a animation with a delay.
+ popup.Show();
+
+ // Wait for a while (allow animation to complete), and then check state.
+ for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ }
+
+ DALI_TEST_CHECK( backgroundImage.OnStage() );
+
+ // Hide
+ gHidden = false;
+ popup.Hide();
+
+ // Wait for a while (allow animation to complete), and then check state.
+ for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ }
+
+ DALI_TEST_CHECK( !backgroundImage.OnStage() );
+ DALI_TEST_CHECK( gHidden );
+ END_TEST;
+}
+
+int UtcDaliPopupShowHideTail(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupShowHideTail");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+
+ popup.HideTail();
+ int withoutTailCount = DescendentCount(popup);
+
+ popup.ShowTail(ParentOrigin::BOTTOM_CENTER);
+ int withTailCount = DescendentCount(popup);
+
+ // There should be more actors if the Tail has been added.
+ DALI_TEST_CHECK( withTailCount > withoutTailCount );
+
+ // Hide again
+ popup.HideTail();
+ int withoutTailCount2 = DescendentCount(popup);
+
+ DALI_TEST_CHECK( withTailCount > withoutTailCount2 );
+ END_TEST;
+}
+
+int UtcDaliPopupOnTouchedOutside(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliPopupOnTouchedOutside");
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ Stage::GetCurrent().Add( popup );
+ popup.SetParentOrigin(ParentOrigin::CENTER);
+ popup.SetAnchorPoint(ParentOrigin::CENTER);
+ popup.SetState(Popup::POPUP_SHOW, 0.0f);
+ popup.OutsideTouchedSignal().Connect( &OnPopupTouchedOutside );
+
+ application.SendNotification();
+ application.Render();
+
+ gTouchedOutside = false;
+ Dali::Integration::TouchEvent event;
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.ProcessEvent( event );
+
+ application.SendNotification();
+ application.Render();
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.ProcessEvent( event );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gTouchedOutside);
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void utc_dali_toolkit_pushbutton_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_pushbutton_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+static bool gPushButtonToggleState = false;
+bool PushButtonToggled( Button button, bool toggled )
+{
+ gPushButtonToggleState = toggled && ( toggled == static_cast<PushButton&>( button ).IsToggled() );
+ return true;
+}
+
+static bool gPushButtonPressed = false;
+
+static bool PushButtonPressed( Button button )
+{
+ gPushButtonPressed = true;
+ return true;
+}
+
+static bool gPushButtonReleased = false;
+
+static bool PushButtonReleased( Button button )
+{
+ gPushButtonReleased = true;
+ return true;
+}
+
+const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 );
+const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 );
+const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 );
+const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 );
+const Dali::TouchPoint pointMotionOut( 0, TouchPoint::Motion, 10, 10 );
+const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 );
+const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 );
+
+static bool gOnTouchPointInterrupted = false;
+
+
+Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
+{
+ BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 );
+
+ // Create the image
+ PixelBuffer* pixbuf = imageData.GetBuffer();
+ unsigned int size = width * height;
+
+ for( size_t i = 0; i < size; i++ )
+ {
+ pixbuf[i*4+0] = 0xFF * color.r;
+ pixbuf[i*4+1] = 0xFF * color.g;
+ pixbuf[i*4+2] = 0xFF * color.b;
+ pixbuf[i*4+3] = 0xFF * color.a;
+ }
+
+ imageData.Update();
+
+ return imageData;
+}
+
+} //namespace
+
+
+int UtcDaliPushButtonSetGetAutoRepeating(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+
+ pushButton.SetAutoRepeating( false );
+
+ DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetToggleButton(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetToggleButton");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetToggleButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggleButton() );
+
+ pushButton.SetToggleButton( false );
+
+ DALI_TEST_CHECK( !pushButton.IsToggleButton() );
+
+ pushButton.SetToggleButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggleButton() );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+ pushButton.SetToggleButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggleButton() );
+ DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+
+ pushButton.SetToggleButton( true );
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+ DALI_TEST_CHECK( !pushButton.IsToggleButton() );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetToggled01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetToggled01");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetToggleButton( true );
+ pushButton.ToggledSignal().Connect( &PushButtonToggled );
+
+ gPushButtonToggleState = false;
+ pushButton.SetToggled( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggled() );
+ DALI_TEST_CHECK( gPushButtonToggleState );
+
+ pushButton.SetToggled( false );
+
+ DALI_TEST_CHECK( !pushButton.IsToggled() );
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ pushButton.SetToggled( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggled() );
+ DALI_TEST_CHECK( gPushButtonToggleState );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetToggled02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetToggled02");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetToggleButton( false );
+ pushButton.ToggledSignal().Connect( &PushButtonToggled );
+
+ gPushButtonToggleState = false;
+ pushButton.SetToggled( true );
+
+ DALI_TEST_CHECK( !pushButton.IsToggled() );
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ pushButton.SetToggled( false );
+
+ DALI_TEST_CHECK( !pushButton.IsToggled() );
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ pushButton.SetToggled( true );
+
+ DALI_TEST_CHECK( !pushButton.IsToggled() );
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+
+ pushButton.SetInitialAutoRepeatingDelay( 1.f );
+ DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+
+ pushButton.SetNextAutoRepeatingDelay( 1.f );
+ DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
+
+ PushButton pushButton = PushButton::New();
+
+ bool assert1( false );
+ bool assert2( false );
+
+ pushButton.SetAutoRepeating( true );
+
+ try
+ {
+ pushButton.SetInitialAutoRepeatingDelay( -1.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "initialAutoRepeatingDelay > 0.f", TEST_LOCATION);
+ assert1 = true;
+ }
+
+ try
+ {
+ pushButton.SetNextAutoRepeatingDelay( -1.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "nextAutoRepeatingDelay > 0.f", TEST_LOCATION);
+ assert2 = true;
+ }
+
+ DALI_TEST_CHECK( assert1 && assert2 );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetImages(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetImages");
+
+ Actor imageActor;
+
+ Image image01 = CreateSolidColorImage( Color::RED, 10, 10 );
+ ImageActor imageActor01 = CreateSolidColorActor( Color::RED );
+ imageActor01.SetSize( 20.f, 20.f );
+
+ Image image02 = CreateSolidColorImage( Color::RED, 30, 30 );
+ ImageActor imageActor02 = CreateSolidColorActor( Color::RED );
+ imageActor02.SetSize( 40.f, 40.f );
+
+ Image image03 = CreateSolidColorImage( Color::RED, 50, 50 );
+ ImageActor imageActor03 = CreateSolidColorActor( Color::RED );
+ imageActor03.SetSize( 60.f, 60.f );
+
+ Image image04 = CreateSolidColorImage( Color::RED, 70, 70 );
+ ImageActor imageActor04 = CreateSolidColorActor( Color::RED );
+ imageActor04.SetSize( 80.f, 80.f );
+
+ Image image05 = CreateSolidColorImage( Color::RED, 90, 90 );
+ ImageActor imageActor05 = CreateSolidColorActor( Color::RED );
+ imageActor05.SetSize( 100.f, 100.f );
+
+ Vector3 size;
+ PushButton pushButton = PushButton::New();
+
+ application.SendNotification();
+ application.Render();
+
+ // Just check if check box button size changes when a bigger image is set.
+
+ pushButton.SetButtonImage( image01 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetButtonImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+
+ pushButton.SetButtonImage( imageActor01 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetButtonImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION );
+
+ pushButton.SetBackgroundImage( image02 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION );
+
+ pushButton.SetBackgroundImage( imageActor02 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION );
+
+ pushButton.SetPressedImage( image03 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetPressedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION );
+
+ pushButton.SetPressedImage( imageActor03 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetPressedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION );
+
+ pushButton.SetDimmedBackgroundImage( image04 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetDimmedBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION );
+
+ pushButton.SetDimmedBackgroundImage( imageActor04 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetDimmedBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION );
+
+ pushButton.SetDimmedImage( image05 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetDimmedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 90.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 90.f, TEST_LOCATION );
+
+ pushButton.SetDimmedImage( imageActor05 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetDimmedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 100.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 100.f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetLabelText(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetLabelText");
+
+ const std::string STR( "Hola!" );
+
+ PushButton pushButton = PushButton::New();
+
+ application.SendNotification();
+ application.Render();
+
+ TextView textView;
+
+ pushButton.SetLabelText( STR );
+
+ textView = TextView::DownCast( pushButton.GetLabelText() );
+ DALI_TEST_CHECK( STR == textView.GetText() );
+
+ TextView text = TextView::New( STR );
+ pushButton.SetLabelText( text );
+
+ textView = TextView::DownCast( pushButton.GetLabelText() );
+ DALI_TEST_CHECK( STR == textView.GetText() );
+ END_TEST;
+}
+
+int UtcDaliPushButtonPressed(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonPressed");
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ gPushButtonPressed = false;
+
+ // connect to its touch signal
+ pushButton.PressedSignal().Connect( &PushButtonPressed );
+
+ Dali::Integration::TouchEvent eventDown;
+ eventDown.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.ProcessEvent( eventDown );
+
+ DALI_TEST_CHECK( gPushButtonPressed );
+ END_TEST;
+}
+
+int UtcDaliPushButtonReleased(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonReleased");
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ // connect to its touch signal
+ pushButton.ReleasedSignal().Connect( &PushButtonReleased );
+
+ Dali::Integration::TouchEvent event;
+
+ // Test1. Touch point down and up inside the button.
+
+ gPushButtonReleased = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gPushButtonReleased );
+
+ // Test2. Touch point down and up outside the button.
+
+ gPushButtonReleased = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonReleased );
+
+ // Test3. Touch point down inside and up outside the button.
+
+ gPushButtonReleased = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointLeave );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gPushButtonReleased );
+
+ // Test4. Touch point down outside and up inside the button.
+
+ gPushButtonReleased = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointEnter );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonReleased );
+ END_TEST;
+}
+
+int UtcDaliPushButtonToggled(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonToggled");
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ // connect to its touch signal
+ pushButton.ToggledSignal().Connect( &PushButtonToggled );
+
+ Dali::Integration::TouchEvent event;
+
+ // Test1. No toggle button.
+
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ // Set toggle property.
+ pushButton.SetToggleButton( true );
+
+ // Test2. Touch point down and up inside the button twice.
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( gPushButtonToggleState );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ // Test3. Touch point down and up outside the button.
+
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ // Test4. Touch point down inside and up outside the button.
+
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointLeave );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ // Test5. Touch point down outside and up inside the button.
+
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointEnter );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.ProcessEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+
+void utc_dali_toolkit_ripple_2d_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_ripple_2d_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliRipple2DEffectUninitialized(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::Ripple2DEffect effect;
+
+ try
+ {
+ // New() must be called to create a Ripple2DEffect or it wont be valid.
+ effect.SetAmplitude( 0.5f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliRipple2DEffectPropertyNames(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetAmplitudePropertyName(), "uAmplitude", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetTimePropertyName(), "uTime", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliRipple2DEffectDefaultValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetAmplitudePropertyName().c_str(),
+ 0.0f ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetTimePropertyName().c_str(),
+ 0.0f ) );
+ END_TEST;
+}
+
+int UtcDaliRipple2DEffectCustomValues(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+
+ effect.SetAmplitude( 5.0f );
+ effect.SetTime( 2.0f );
+
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetAmplitudePropertyName().c_str(),
+ 5.0f ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetTimePropertyName().c_str(),
+ 2.0f ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+void utc_dali_toolkit_ripple_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_ripple_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+int UtcDaliRippleUninitializedEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::RippleEffect effect;
+
+ try
+ {
+ // New() must be called to create a RippleEffect or it wont be valid.
+ effect.SetAmplitude( 0.5f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliRipplePropertyNamesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::RippleEffect effect = Toolkit::RippleEffect::New();
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetAmplitudePropertyName(), "uAmplitude", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetTimePropertyName(), "uTime", TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliRippleDefaultValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::RippleEffect effect = Toolkit::RippleEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetAmplitudePropertyName().c_str(),
+ 0.0f ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName().c_str(),
+ Vector2( 0.0f, 0.0f ) ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetTimePropertyName().c_str(),
+ 0.0f ) );
+ END_TEST;
+}
+
+int UtcDaliRippleCustomValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::RippleEffect effect = Toolkit::RippleEffect::New();
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ effect.SetAmplitude( 0.5f );
+ effect.SetCenter( Vector2( 10.0f, 10.0f ) );
+ effect.SetTime( 2.0f );
+
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetAmplitudePropertyName().c_str(),
+ 0.5f ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName().c_str(),
+ Vector2( 10.0f, 10.0f ) ) );
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetTimePropertyName().c_str(),
+ 2.0f ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void utc_dali_toolkit_scroll_view_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_scroll_view_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+const int MILLISECONDS_PER_SECOND = 1000;
+const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation
+const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete.
+
+/*
+ * Simulate time passed by.
+ *
+ * @note this will always process at least 1 frame (1/60 sec)
+ *
+ * @param application Test application instance
+ * @param duration Time to pass in milliseconds.
+ * @return The actual time passed in milliseconds
+ */
+int Wait(ToolkitTestApplication& application, int duration = 0)
+{
+ int time = 0;
+
+ for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ time += RENDER_FRAME_INTERVAL;
+ }
+
+ return time;
+}
+
+/**
+ * Creates a Ruler that snaps to a specified grid size.
+ * If that grid size is 0.0 then this ruler does not
+ * snap.
+ *
+ * @param[in] gridSize (optional) The grid size for the ruler,
+ * (Default = 0.0 i.e. no snapping)
+ * @return The ruler is returned.
+ */
+RulerPtr CreateRuler(float gridSize = 0.0f)
+{
+ if(gridSize <= Math::MACHINE_EPSILON_0)
+ {
+ return new DefaultRuler();
+ }
+ return new FixedRuler(gridSize);
+}
+
+// Callback probes.
+
+static bool gOnScrollStartCalled; ///< Whether the OnScrollStart signal was invoked.
+static bool gOnScrollUpdateCalled; ///< Whether the OnScrollUpdate signal was invoked.
+static bool gOnScrollCompleteCalled; ///< Whether the OnScrollComplete signal was invoked.
+static bool gOnScrollClampedCalled; ///< Whether the OnScrollClamped signal was invoked.
+static bool gOnSnapStartCalled; ///< Whether the OnSnapStart signal was invoked.
+static ClampState3 gLastClampPosition; ///< Clamping information from OnScrollClampedEvent.
+static SnapType gLastSnapType; ///< Snaping information from SnapEvent.
+static Vector3 gConstraintResult; ///< Result from constraint.
+
+static ActorContainer gPages; ///< Keeps track of all the pages for applying effects.
+
+static void ResetScrollCallbackResults()
+{
+ gOnScrollStartCalled = false;
+ gOnScrollUpdateCalled = false;
+ gOnScrollCompleteCalled = false;
+}
+
+/**
+ * Invoked when scrolling starts.
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollStart( const Vector3& position )
+{
+ gOnScrollStartCalled = true;
+}
+
+/**
+ * Invoked when scrolling updates (via dragging)
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollUpdate( const Vector3& position )
+{
+ gOnScrollUpdateCalled = true;
+}
+
+/**
+ * Invoked when scrolling finishes
+ *
+ * @param[in] position The current scroll position.
+ */
+static void OnScrollComplete( const Vector3& position )
+{
+ gOnScrollCompleteCalled = true;
+}
+
+/**
+ * Invoked when scrolling clamped.
+ *
+ * @param[in] event The position/scale/rotation axes that were clamped.
+ */
+static void OnScrollClamped( const ScrollView::ClampEvent& event )
+{
+ gOnScrollClampedCalled = true;
+ gLastClampPosition = event.position;
+}
+
+/**
+ * Invoked when a snap or flick started.
+ *
+ * @param[in] event The type of snap and the target position/scale/rotation.
+ */
+static void OnSnapStart( const ScrollView::SnapEvent& event )
+{
+ gOnSnapStartCalled = true;
+ gLastSnapType = event.type;
+}
+
+ScrollView SetupTestScrollView(int rows, int columns, Vector2 size)
+{
+ ScrollView scrollView = ScrollView::New();
+ scrollView.SetSize(size);
+ scrollView.SetAnchorPoint(AnchorPoint::CENTER);
+ scrollView.SetParentOrigin(ParentOrigin::CENTER);
+ scrollView.ApplyConstraint( Constraint::New<Dali::Vector3>( 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<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+
+ gPages.clear();
+ for(int row = 0;row<rows;row++)
+ {
+ for(int column = 0;column<columns;column++)
+ {
+ Actor page = Actor::New();
+ page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ page.SetParentOrigin( ParentOrigin::CENTER );
+ page.SetAnchorPoint( AnchorPoint::CENTER );
+ page.SetPosition( column * size.x, row * size.y );
+ container.Add(page);
+
+ gPages.push_back(page);
+ }
+ }
+
+ ResetScrollCallbackResults();
+ return scrollView;
+}
+
+void CleanupTest()
+{
+ gPages.clear();
+ ResetScrollCallbackResults();
+}
+
+Actor AddActorToPage(Actor page, float x, float y, float cols, float rows)
+{
+ Stage stage = Stage::GetCurrent();
+ Vector2 stageSize = stage.GetSize();
+
+ const float margin = 10.0f;
+ const Vector2 actorSize((stageSize.x / cols) - margin, (stageSize.y / rows) - margin);
+
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::CENTER );
+ actor.SetAnchorPoint( AnchorPoint::CENTER );
+
+ Vector3 position( margin * 0.5f + (actorSize.x + margin) * x - stageSize.width * 0.5f,
+ margin * 0.5f + (actorSize.y + margin) * y - stageSize.height * 0.5f,
+ 0.0f);
+ Vector3 positionEnd( margin * 0.5f + (actorSize.x + margin) * (x + cols) - stageSize.width * 0.5f - margin,
+ margin * 0.5f + (actorSize.y + margin) * (y + rows) - stageSize.height * 0.5f - margin,
+ 0.0f);
+ Vector3 size(positionEnd - position);
+ actor.SetPosition( position + size * 0.5f);
+ actor.SetSize( positionEnd - position );
+ page.Add(actor);
+ return actor;
+}
+
+} // unnamed namespace
+
+
+int UtcDaliScrollViewCustomEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewCustomEffectSetup");
+
+ ScrollViewCustomEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewCustomEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewCustomEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+
+ END_TEST;
+}
+
+int UtcDaliScrollViewCubeEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewCubeEffectSetup");
+
+ ScrollViewCubeEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewCubeEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewCubeEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+int UtcDaliScrollViewSpiralEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewSpiralEffectSetup");
+
+ ScrollViewPageSpiralEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewPageSpiralEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewPageSpiralEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+
+
+
+int UtcDaliScrollViewSlideEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewSlideEffectSetup");
+
+ ScrollViewSlideEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewSlideEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewSlideEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+int UtcDaliScrollViewTwistEffectSetup(void)
+{
+ tet_infoline(" UtcDaliScrollViewTwistEffectSetup");
+
+ ScrollViewTwistEffect effect;
+
+ DALI_TEST_CHECK( !effect );
+
+ BaseHandle handle = ScrollViewTwistEffect::New();
+
+ DALI_TEST_CHECK( handle );
+
+ effect = ScrollViewTwistEffect::DownCast(handle);
+
+ DALI_TEST_CHECK( effect );
+ END_TEST;
+}
+
+int UtcDaliScrollViewCubeEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewCubeEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor page = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewCubeEffect effect = ScrollViewCubeEffect::New();
+ scrollView.ApplyEffect(effect);
+
+ Actor actor = AddActorToPage(page, 0.5f, 0.5f, 3, 3);
+ Wait(application);
+ Vector3 actorPrePosition = actor.GetCurrentPosition();
+
+ effect.ApplyToActor(actor, page, Vector3(-105.0f, 30.0f, -240.0f), Vector2(Math::PI * 0.5f, Math::PI * 0.5f), Vector2(0.25f, 0.25f) * size);
+
+ Actor actor2 = AddActorToPage(page, 0.5f, 0.5f, 3, 3);
+ effect.ApplyToActor(actor2, Vector3(-105.0f, 30.0f, -240.0f), Vector2(Math::PI * 0.5f, Math::PI * 0.5f), Vector2(0.25f, 0.25f) * size);
+
+ scrollView.ScrollTo(1);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ // test that the first page has reached centre of screen
+ Vector3 actorPostPosition = actor.GetCurrentPosition();
+ // just check the actor has moved
+ DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
+ CleanupTest();
+ END_TEST;
+}
+
+
+int UtcDaliScrollViewSpiralEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSpiralEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewPageSpiralEffect effect = ScrollViewPageSpiralEffect::New();
+ scrollView.ApplyEffect(effect);
+
+ for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
+ {
+ Actor page = *pageIter;
+ page.RemoveConstraints();
+ page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ effect.ApplyToPage(page, Vector2(Math::PI_2, 0.0f));
+ }
+ Wait(application);
+
+ scrollView.ScrollTo(1);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ // test that the first page has reached centre of screen
+ Vector3 pagePos = testPage.GetCurrentPosition();
+ DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ CleanupTest();
+ END_TEST;
+}
+
+
+
+int UtcDaliScrollViewSlideEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewSlideEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+ Vector3 pageSize(size.x, size.y, 0.0f);
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewSlideEffect effect = ScrollViewSlideEffect::New();
+ effect.SetDelayReferenceOffset(pageSize * 0.25);
+ DALI_TEST_EQUALS(effect.GetDelayReferenceOffset(), pageSize * 0.25, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ effect.SetMaxDelayDuration(0.5f);
+ DALI_TEST_EQUALS(effect.GetMaxDelayDuration(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ effect.SetSlideDirection(false);
+ DALI_TEST_CHECK(!effect.GetSlideDirection());
+
+ scrollView.ApplyEffect(effect);
+
+ Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
+ Wait(application);
+ Vector3 actorPrePosition = actor.GetCurrentPosition();
+
+ effect.ApplyToActor(actor, 0.0f, 0.5f);
+
+ scrollView.ScrollTo(1);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ // test that the first page has reached centre of screen
+ Vector3 actorPostPosition = actor.GetCurrentPosition();
+ // just check the actor has moved
+ DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
+ CleanupTest();
+ END_TEST;
+}
+
+int UtcDaliScrollViewTwistEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewTwistEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+
+ ScrollViewTwistEffect effect = ScrollViewTwistEffect::New();
+ float shrinkDist = 0.2f;
+ effect.SetMinimumDistanceForShrink(shrinkDist);
+ DALI_TEST_CHECK((shrinkDist - effect.GetMinimumDistanceForShrink()) < Math::MACHINE_EPSILON_0);
+ effect.EnableEffect(true);
+ scrollView.ApplyEffect(effect);
+
+ Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
+ Wait(application);
+ Vector3 actorPrePosition = actor.GetCurrentPosition();
+
+ effect.ApplyToActor( actor,
+ true,
+ Vector2(Math::PI_2, Math::PI_2),
+ 0.0f);
+
+ scrollView.ScrollTo(1);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ // test that the first page has reached centre of screen
+ Vector3 actorPostPosition = actor.GetCurrentPosition();
+ // just check the actor has moved
+ DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
+ CleanupTest();
+ END_TEST;
+}
+
+int UtcDaliScrollViewCustomEffectTest(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliScrollViewCustomEffectTest");
+
+ Vector2 size = Stage::GetCurrent().GetSize();
+ Vector3 pageSize(size.x, size.y, 0.0f);
+
+ ScrollView scrollView = SetupTestScrollView(1, 3, size);
+ Actor testPage = gPages[1];
+ Wait(application, 500);
+ Vector3 pageStartPos, pagePos;
+ pageStartPos = pagePos = testPage.GetCurrentPosition();
+ //scrollView.RemoveConstraintsFromChildren();
+
+ ScrollViewCustomEffect effect = ScrollViewCustomEffect::DownCast(scrollView.ApplyEffect(ScrollView::PageEffectCarousel));
+
+ for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter)
+ {
+ Actor page = *pageIter;
+ page.RemoveConstraints();
+ page.ApplyConstraint( Constraint::New<Vector3>( 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<Vector3>( 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<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ effect.ApplyToPage(page, pageSize);
+ }
+ Wait(application);
+
+ scrollView.ScrollTo(1);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ ResetScrollCallbackResults();
+ // test that the first page has reached centre of screen
+ pagePos = testPage.GetCurrentPosition();
+ DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+
+ // scroll back to page 0
+ scrollView.ScrollTo(0);
+ while(!gOnScrollCompleteCalled)
+ {
+ Wait(application);
+ }
+ ResetScrollCallbackResults();
+ pagePos = testPage.GetCurrentPosition();
+ DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ scrollView.RemoveEffect(effect);
+
+
+ effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear);
+ effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
+ effect.SetPageTranslateAlphaFunctionIn(AlphaFunctions::Linear);
+ effect.SetPageTranslateAlphaFunctionOut(AlphaFunctions::Linear);
+ effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS);
+ effect.SetAngledOriginPageRotation(Vector3(Math::PI, Math::PI, 0.0f));
+ effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS);
+ effect.SetGlobalPageRotationIn(Math::PI, Vector3::YAXIS);
+ effect.SetGlobalPageRotationOut(Math::PI, Vector3::YAXIS);
+ effect.SetGlobalPageRotationOrigin(Vector3::ZERO);
+ effect.SetGlobalPageRotationOrigin(Vector3::ZERO, Vector3::ZERO);
+ effect.SetGlobalPageRotationOriginIn(Vector3::ZERO);
+ effect.SetGlobalPageRotationOriginOut(Vector3::ZERO);
+ effect.SetSwingAngle(Math::PI, Vector3::YAXIS);
+ effect.SetSwingAngle(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS);
+ effect.SetSwingAngleIn(Math::PI, Vector3::YAXIS);
+ effect.SetSwingAngleOut(Math::PI, Vector3::YAXIS);
+ effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear);
+ effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
+ effect.SetSwingAngleAlphaFunctionIn(AlphaFunctions::Linear);
+ effect.SetSwingAngleAlphaFunctionOut(AlphaFunctions::Linear);
+ effect.SetSwingAnchor(AnchorPoint::CENTER, AnchorPoint::CENTER_LEFT);
+ effect.SetSwingAnchorIn(AnchorPoint::CENTER);
+ effect.SetSwingAnchorOut(AnchorPoint::CENTER);
+ effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear);
+ effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
+ effect.SetSwingAnchorAlphaFunctionIn(AlphaFunctions::Linear);
+ effect.SetSwingAnchorAlphaFunctionOut(AlphaFunctions::Linear);
+ effect.SetOpacityThreshold(0.5f);
+ effect.SetOpacityThreshold(0.5f, 0.5f);
+ effect.SetOpacityThresholdIn(0.5f);
+ effect.SetOpacityThresholdOut(0.5f);
+ effect.SetOpacityAlphaFunction(AlphaFunctions::Linear);
+ effect.SetOpacityAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear);
+ effect.SetOpacityAlphaFunctionIn(AlphaFunctions::Linear);
+ effect.SetOpacityAlphaFunctionOut(AlphaFunctions::Linear);
+ CleanupTest();
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void utc_dali_toolkit_super_blur_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_super_blur_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+const int BLUR_LEVELS = 3;
+const int RENDER_FRAME_INTERVAL = 16;
+
+static bool gObjectCreatedCallBackCalled;
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+/*
+ * Simulate time passed by.
+ *
+ * @note this will always process at least 1 frame (1/60 sec)
+ *
+ * @param application Test application instance
+ * @param duration Time to pass in milliseconds.
+ * @return The actual time passed in milliseconds
+ */
+int Wait(ToolkitTestApplication& application, int duration = 0)
+{
+ int time = 0;
+
+ for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ time += RENDER_FRAME_INTERVAL;
+ }
+
+ return time;
+}
+
+Image CreateSolidColorImage( ToolkitTestApplication& application, const Vector4& color, unsigned int width, unsigned int height )
+{
+ BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 );
+
+ // Create the image
+ PixelBuffer* pixbuf = imageData.GetBuffer();
+ unsigned int size = width * height;
+
+ for( size_t i = 0; i < size; i++ )
+ {
+ pixbuf[i*4+0] = 0xFF * color.r;
+ pixbuf[i*4+1] = 0xFF * color.g;
+ pixbuf[i*4+2] = 0xFF * color.b;
+ pixbuf[i*4+3] = 0xFF * color.a;
+ }
+ imageData.Update();
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+
+ return imageData;
+}
+}//namespace
+
+
+int UtcDaliSuperBlurViewNew(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliSuperBlurViewNew ");
+
+ // Test default constructor.
+ SuperBlurView blurView;
+ DALI_TEST_CHECK( !blurView );
+
+ // Test object creation
+ blurView = SuperBlurView::New( BLUR_LEVELS );
+ DALI_TEST_CHECK( blurView );
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS );
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ // Test copy constructor
+ SuperBlurView blurViewCopy2( blurView );
+ DALI_TEST_CHECK( blurViewCopy2 );
+
+ // Test down cast
+ Actor actorView;
+ actorView = blurView;
+ SuperBlurView downCastView = SuperBlurView::DownCast( actorView );
+ DALI_TEST_CHECK( downCastView );
+ END_TEST;
+}
+
+int UtcDaliSuperBlurViewSetImage(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliSuperBlurViewSetImage ");
+
+ SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS );
+ // create image actors for the original image and each blurred image
+ DALI_TEST_CHECK( blurView.GetChildCount() == BLUR_LEVELS+1 );
+
+ Image inputImage = CreateSolidColorImage( application, Color::GREEN, 50, 50 );
+ blurView.SetImage( inputImage );
+ // start multiple guassian blur call, each guassian blur creates two render tasks
+ DALI_TEST_CHECK( Stage::GetCurrent().GetRenderTaskList().GetTaskCount() == BLUR_LEVELS*2 + 1);
+ END_TEST;
+}
+
+int UtcDaliSuperBlurViewSetGetBlurStrength(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliSuperBlurViewSetGetBlurStrength ");
+
+ SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS );
+ DALI_TEST_EQUALS(blurView.GetCurrentBlurStrength(), 0.f, TEST_LOCATION );
+
+ blurView.SetBlurStrength( 0.65f );
+ Wait(application);
+ DALI_TEST_EQUALS(blurView.GetCurrentBlurStrength(), 0.65f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliSuperBlurViewGetBlurStrengthPropertyIndex ");
+
+ SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS );
+ Property::Index blurPropertyIdx = blurView.GetBlurStrengthPropertyIndex();
+
+ float blurStrength;
+ (blurView.GetProperty( blurPropertyIdx )).Get(blurStrength);
+ DALI_TEST_EQUALS(blurStrength, 0.f, TEST_LOCATION );
+
+ blurView.SetBlurStrength( 0.65f );
+ Wait(application);
+ (blurView.GetProperty( blurPropertyIdx )).Get(blurStrength);
+ DALI_TEST_EQUALS(blurStrength, 0.65f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSuperBlurViewGetBlurredImage(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliSuperBlurViewGetBlurredImage" );
+
+ SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS );
+ blurView.SetSize( 100.f,100.f );
+ Image inputImage = CreateSolidColorImage( application, Color::GREEN, 100, 100 );
+ blurView.SetImage( inputImage );
+
+ Wait(application, 200); // Make sure all the gaussian blur finished
+
+ Image image1 = blurView.GetBlurredImage( 1 );
+ DALI_TEST_CHECK( image1 );
+
+ Image image2 = blurView.GetBlurredImage( 2 );
+ DALI_TEST_CHECK( image2.GetWidth() == 25 );
+ DALI_TEST_CHECK( image2.GetHeight() == 25 );
+
+ Image image3 = blurView.GetBlurredImage( 3 );
+ DALI_TEST_CHECK( FrameBufferImage::DownCast( image2 ) );
+
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+
+void utc_dali_toolkit_swirl_effect_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_swirl_effect_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliSwirlUninitializedEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SwirlEffect effect;
+
+ try
+ {
+ // New() must be called to create a SwirlEffect or it wont be valid.
+ effect.SetRadius( 0.5f );
+ DALI_TEST_CHECK( false );
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_CHECK(!effect);
+ }
+ END_TEST;
+}
+
+int UtcDaliSwirlPropertyNamesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(false);
+
+ // Check the names, this names are used in the shaders code,
+ // if they change the shader code has to be updated
+ DALI_TEST_EQUALS( effect.GetAnglePropertyName(), "uAngle", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
+ DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliSwirlDefaultValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(true);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetAnglePropertyName().c_str(),
+ 0.0f ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName().c_str(),
+ Vector2(0.5f, 0.5f) ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetRadiusPropertyName().c_str(),
+ 1.0f ) );
+ END_TEST;
+}
+
+int UtcDaliSwirlCustomValuesEffect(void)
+{
+ ToolkitTestApplication application;
+
+ Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(false);
+ DALI_TEST_CHECK( effect );
+
+ BitmapImage image = CreateBitmapImage();
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+
+ effect.SetAngle( 1.0f );
+ effect.SetCenter( Vector2(0.3f, 0.7f) );
+ effect.SetRadius( 2.0f );
+
+ actor.SetShaderEffect( effect );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ // Gets converted to opengl viewport coordinates
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetAnglePropertyName().c_str(),
+ 1.0f ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetCenterPropertyName().c_str(),
+ Vector2(0.3f, 0.7f) ) );
+
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ effect.GetRadiusPropertyName().c_str(),
+ 2.0f ) );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/key-event-integ.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void utc_dali_toolkit_text_input_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_text_input_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ Actor actor = Actor::DownCast(handle);
+
+ if(actor)
+ {
+ TextInput handle = TextInput::DownCast(actor);
+ if (handle)
+ {
+ gObjectCreatedCallBackCalled = true;
+ }
+ }
+}
+
+static bool gHasEndSignalBeenReceived;
+static bool gHasStartSignalBeenReceived;
+
+// Callback test function
+void OnStartInput(TextInput textInput)
+{
+ gHasStartSignalBeenReceived = true;
+}
+
+// Callback test function
+void OnEndInput(TextInput textInput)
+{
+ gHasEndSignalBeenReceived = true;
+}
+
+}
+
+// Positive test case for a method
+int UtcDaliTextInputConstruction(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing New constructor");
+
+ TextInput textInput = TextInput::New();
+ DALI_TEST_CHECK(textInput);
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ TextInput textInput = TextInput::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+
+static bool downCastToTextInput(Dali::Actor actor)
+{
+ TextInput handle = TextInput::DownCast(actor);
+ if (handle)
+ {
+ tet_infoline("Downcasted to TextInput");
+ return true;
+ }
+ else
+ {
+ tet_infoline("Did not downcast to TextInput");
+ return false;
+ }
+}
+
+// Positive test case for a method
+int UtcDaliTextInputDownCast(void)
+{
+ ToolkitTestApplication application;
+
+ TextInput textInput = TextInput::New();
+
+ tet_infoline("Testing Downcasting with a TextInput");
+ DALI_TEST_EQUALS(true,downCastToTextInput(textInput), TEST_LOCATION); // downcast a TextInput
+
+ Dali::TextActor badHandle = Dali::TextActor::New("test");
+
+ tet_infoline("Testing Downcasting with the wrong actor");
+ DALI_TEST_EQUALS(false, downCastToTextInput(badHandle), TEST_LOCATION); // downcast a TextActor to TextInput
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliTextInputGetText(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing GetText");
+
+ const std::string teststring = "test";
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION); // Get text which should be empty
+
+ textInput.SetInitialText(teststring);
+
+ DALI_TEST_EQUALS(teststring,textInput.GetText(), TEST_LOCATION); // Get text which should be test string
+
+ END_TEST;
+}
+
+int UtcDaliTextInputGetMarkupText(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing retrieval of Markup text after style set");
+
+ const std::string markup = "<i>Text with italic style</i>" ;
+ const std::string teststring = "Text with italic style";
+
+ TextInput textInput = TextInput::New();
+
+ tet_infoline("Set initial text");
+
+ textInput.SetInitialText( teststring );
+
+ tet_infoline("Check initial text");
+ DALI_TEST_EQUALS( teststring,textInput.GetText(), TEST_LOCATION); // Get text which should be empty
+
+ TextStyle style;
+ style.SetItalics( true );
+
+ tet_infoline("Apply style to TextInput");
+ textInput.ApplyStyleToAll( style );
+
+ tet_infoline("Retreive Markup Text");
+ const std::string retreivedMarkupString = textInput.GetMarkupText();
+
+ tet_infoline("Test Retreived text and Markup text match");
+ DALI_TEST_EQUALS( retreivedMarkupString , retreivedMarkupString, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputSetMaxCharacterLength(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing Setting of max characters");
+
+ const int maxChars = 4;
+ const char* testChar = "v";
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+ Stage::GetCurrent().Add(textInput);
+ application.SendNotification();
+ application.Render();
+
+ textInput.SetMaxCharacterLength(maxChars);
+
+ Integration::KeyEvent event(testChar, testChar, 0, 0, 0, Integration::KeyEvent::Down );
+
+ std::string testString = "";
+
+ tet_infoline("Starting editmode");
+ textInput.SetEditable( true );
+
+ tet_infoline("Sending Key Events");
+ // Send max number of characters
+ for (int i=0; i < maxChars; i++)
+ {
+ application.ProcessEvent(event);
+ testString.append(testChar);
+ }
+
+ tet_printf( "Get text result : %s\n", textInput.GetText().c_str());
+
+ DALI_TEST_EQUALS(testString, textInput.GetText(), TEST_LOCATION);
+
+ tet_infoline("Sending Key Event which exceeds max characters");
+
+ application.ProcessEvent(event); // try to append additional character
+
+ DALI_TEST_EQUALS(testString,textInput.GetText(), TEST_LOCATION);
+
+ tet_infoline("Increase max characters limit");
+
+ textInput.SetMaxCharacterLength(maxChars+1); // increment max characters by 1
+
+ tet_infoline("Send character again which should now fit");
+ application.ProcessEvent(event); // append additional character
+ testString.append(testChar);
+
+ DALI_TEST_EQUALS(testString,textInput.GetText(), TEST_LOCATION);
+ END_TEST;
+}
+
+
+int UtcDaliTextInputSetAndGetNumberOfLines(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Ensuring API for setting and getting max number of lines is correct");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ unsigned int numberOfLines = 1;
+
+ textInput.SetNumberOfLinesLimit( numberOfLines );
+
+ DALI_TEST_EQUALS(numberOfLines ,textInput.GetNumberOfLinesLimit(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputGetNumberOfCharacters(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing Getting number of characters");
+
+ const std::string initialString = "initial text";
+ const std::string newInitialString = "initial text new";
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ textInput.SetInitialText( initialString );
+
+ tet_infoline("Testing TextInput contains correct number of characters ");
+
+ DALI_TEST_EQUALS( initialString.size() , textInput.GetNumberOfCharacters(), TEST_LOCATION);
+
+ tet_infoline("Testing TextInput contains correct number of characters second phase ");
+
+ textInput.SetInitialText( newInitialString );
+
+ DALI_TEST_EQUALS( newInitialString.size() , textInput.GetNumberOfCharacters(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputSetAndGetPlaceholderText(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing Setting of PlaceholderText");
+
+ const std::string initialString = "initial text";
+ const std::string placeholderString = "placeholder";
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ tet_infoline("Testing TextInput is empty at creation ");
+
+ DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION);
+
+ tet_infoline("Set placeholder text");
+
+ textInput.SetPlaceholderText( placeholderString );
+
+ tet_infoline("Testing TextInput contains placeholder text");
+
+ DALI_TEST_EQUALS( placeholderString , textInput.GetPlaceholderText(), TEST_LOCATION);
+
+ tet_infoline("Set initial text which should replace placeholder text");
+
+ textInput.SetInitialText( initialString );
+
+ tet_infoline("Testing TextInput contains initial text when placeholder text set");
+
+ DALI_TEST_EQUALS( initialString,textInput.GetText(), TEST_LOCATION);
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliTextInputSetInitialText(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing Setting of Initial Text");
+
+ const std::string teststring = "test";
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ tet_infoline("Testing TextInput is empty at creation ");
+
+ DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION);
+
+ tet_infoline("Set text to TextInput");
+
+ textInput.SetInitialText(teststring);
+
+ tet_infoline("Test TextInput contains set text");
+
+ DALI_TEST_EQUALS(teststring,textInput.GetText(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputSetEditableAndIsEditable(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing SetEditable And IsEditable");
+
+ const std::string initialString = "initial text";
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+ textInput.SetInitialText( initialString );
+
+ Stage::GetCurrent().Add(textInput);
+ application.SendNotification();
+ application.Render();
+
+ bool editableStateFalse ( false );
+ bool editableStateTrue ( true );
+
+ textInput.SetEditable ( editableStateFalse );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( editableStateFalse, textInput.IsEditable() , TEST_LOCATION);
+
+ textInput.SetEditable ( editableStateTrue );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( editableStateTrue, textInput.IsEditable() , TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputSetEditOnTouch(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing SetEditOnTouch And IsEditOnTouch");
+
+ TextInput textInput = TextInput::New();
+
+ bool editableOnTouchOn ( true );
+ bool editableOnTouchOff( false );
+
+ tet_infoline("Testing SetEditOnTouch disabled");
+ textInput.SetEditOnTouch ( editableOnTouchOff );
+ DALI_TEST_EQUALS( editableOnTouchOff, textInput.IsEditOnTouch() , TEST_LOCATION);
+
+ tet_infoline("Testing SetEditOnTouch enabled");
+ textInput.SetEditOnTouch ( editableOnTouchOn );
+ DALI_TEST_EQUALS( editableOnTouchOn, textInput.IsEditOnTouch() , TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputSetTextSelectable(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing SetTextSelectable and IsTextSelectable");
+
+ const std::string initialString = "initial text";
+
+ TextInput textInput = TextInput::New();
+ textInput.SetInitialText( initialString );
+
+ tet_infoline("Testing SetTextSelectable");
+ textInput.SetTextSelectable();
+ DALI_TEST_EQUALS( true, textInput.IsTextSelectable() , TEST_LOCATION);
+ textInput.SetTextSelectable( false );
+ DALI_TEST_EQUALS( false, textInput.IsTextSelectable() , TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputTextSelection(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing Text Selection");
+
+ const std::string initialString = "initial text";
+
+ TextInput textInput = TextInput::New();
+ textInput.SetInitialText( initialString );
+
+ Stage::GetCurrent().Add(textInput);
+ application.SendNotification();
+ application.Render();
+
+ textInput.SetEditable( true );
+
+ tet_infoline("Testing IsTextSelected negative");
+ DALI_TEST_EQUALS( false, textInput.IsTextSelected(), TEST_LOCATION);
+
+ textInput.SelectText(1,7);
+ DALI_TEST_EQUALS( true, textInput.IsTextSelected(), TEST_LOCATION);
+
+ textInput.DeSelectText();
+ DALI_TEST_EQUALS( false, textInput.IsTextSelected(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputEnableGrabHandleAndIsGrabHandleEnabled(void)
+{
+ ToolkitTestApplication application;
+
+ TextInput textInput = TextInput::New();
+
+ bool grabHandleState = false;
+
+ textInput.EnableGrabHandle( grabHandleState );
+
+ DALI_TEST_EQUALS( grabHandleState, textInput.IsGrabHandleEnabled(), TEST_LOCATION);
+
+ grabHandleState = true;
+ textInput.EnableGrabHandle( grabHandleState );
+
+ DALI_TEST_EQUALS( grabHandleState, textInput.IsGrabHandleEnabled(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTextInputSetAndGetBoundingRectangle(void)
+{
+ ToolkitTestApplication application;
+
+ TextInput textInput = TextInput::New();
+
+ Stage::GetCurrent().Add(textInput);
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+
+ const Rect<float> boundingRectangle( 100.0f, 100.0f, stageSize.width, stageSize.height );
+
+ textInput.SetBoundingRectangle( boundingRectangle );
+
+ const Rect<float> retreievedBoundingRectangle = textInput.GetBoundingRectangle();
+
+ DALI_TEST_EQUALS( boundingRectangle.x, retreievedBoundingRectangle.x, TEST_LOCATION);
+ DALI_TEST_EQUALS( boundingRectangle.y, retreievedBoundingRectangle.y, TEST_LOCATION);
+ DALI_TEST_EQUALS( boundingRectangle.width, retreievedBoundingRectangle.width, TEST_LOCATION);
+ DALI_TEST_EQUALS( boundingRectangle.height, retreievedBoundingRectangle.height, TEST_LOCATION);
+ END_TEST;
+}
+
+
+int UtcDaliTextInputSetAndGetTextAlignment(void)
+{
+ ToolkitTestApplication application;
+
+ TextInput textInput = TextInput::New();
+ Stage::GetCurrent().Add(textInput);
+ application.SendNotification();
+ application.Render();
+
+ textInput.SetTextAlignment(static_cast<Alignment::Type>( Alignment::HorizontalCenter) );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( static_cast<Alignment::Type>( Alignment::HorizontalCenter) & textInput.GetTextAlignment()) ;
+ END_TEST;
+}
+
+
+int UtcDaliTextInputSetSortModifier(void)
+{
+ tet_infoline("Testing SetSortModifier does not cause TextInput failure");
+
+ ToolkitTestApplication application;
+
+ TextInput textInput = TextInput::New();
+
+ const float offsetToUse = 1.5f;
+
+ textInput.SetSortModifier( offsetToUse );
+
+ DALI_TEST_CHECK( textInput );
+ END_TEST;
+}
+
+int UtcDaliTextInputSetAndGetSnapshotModeEnabled(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing SetSnapshotModeEnabled and IsSnapshotModeEnabled");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+ bool snapshotMode( true );
+ textInput.SetSnapshotModeEnabled( snapshotMode );
+
+ DALI_TEST_EQUALS( snapshotMode, textInput.IsSnapshotModeEnabled(), TEST_LOCATION);
+
+ snapshotMode = false;
+ textInput.SetSnapshotModeEnabled( snapshotMode );
+
+ DALI_TEST_EQUALS( snapshotMode, textInput.IsSnapshotModeEnabled(), TEST_LOCATION);
+ END_TEST;
+}
+
+
+int UtcDaliTextInputEndSignalEmit(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing Set editable false emits end signal");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ Stage::GetCurrent().Add(textInput);
+
+ textInput.InputFinishedSignal().Connect( &OnEndInput );
+
+ textInput.SetEditable(true) ;
+
+ gHasEndSignalBeenReceived = false;
+
+ textInput.SetEditable(false) ;
+
+ DALI_TEST_EQUALS(true, gHasEndSignalBeenReceived, TEST_LOCATION);
+ END_TEST;
+}
+
+
+
+int UtcDaliTextInputStartSignalEmit(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing SetEditable emits start signal");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ Stage::GetCurrent().Add(textInput);
+
+ textInput.InputStartedSignal().Connect( &OnStartInput );
+
+ gHasStartSignalBeenReceived = false;
+
+ textInput.SetEditable(true); // Set editable first time
+
+ DALI_TEST_EQUALS(true, gHasStartSignalBeenReceived, TEST_LOCATION);
+
+ gHasStartSignalBeenReceived = false;
+
+ textInput.SetEditable(true); // Set editable second time, signal should not be sent again.
+
+ DALI_TEST_EQUALS(false, gHasStartSignalBeenReceived, TEST_LOCATION);
+
+ textInput.SetEditable(false);
+
+ gHasStartSignalBeenReceived = false;
+
+ textInput.SetEditable(true); // Set editable again
+
+ DALI_TEST_EQUALS(true, gHasStartSignalBeenReceived, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliTextInputExceedMaxCharacters(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Testing Max characters is obeyed when inputting key events ");
+
+ TextInput textInput = TextInput::New(); // create empty TextInput
+
+ Stage::GetCurrent().Add(textInput);
+ textInput.SetMaxCharacterLength(4);
+ textInput.SetInitialText("");
+ textInput.SetEditable(true);
+
+ application.SendNotification();
+ application.Render();
+
+ Integration::KeyEvent eventA("a", "a", 0, 0, 0, Integration::KeyEvent::Down );
+ Integration::KeyEvent eventB("b", "b", 0, 0, 0, Integration::KeyEvent::Down );
+
+ application.ProcessEvent(eventA);
+ application.ProcessEvent(eventB);
+ application.ProcessEvent(eventA);
+ application.ProcessEvent(eventB);
+
+ application.ProcessEvent(eventA);
+ application.ProcessEvent(eventB);
+
+ tet_printf( "Get text result : %s\n", textInput.GetText().c_str());
+
+ DALI_TEST_EQUALS("abab",textInput.GetText(), TEST_LOCATION); // Get text which should be only 4 characters
+ END_TEST;
+}
+
+
+
+int UtcDaliTextInputSetAndGetFadeBoundary(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetFadeBoundary: ");
+
+ ToolkitTestApplication application;
+
+ TextView::FadeBoundary fadeBoundary( PixelSize( 0 ), PixelSize( 20 ), PixelSize( 0 ), PixelSize( 10 ) );
+
+ TextInput textInput = TextInput::New();
+ textInput.SetInitialText( "Hello world!" );
+
+ Stage::GetCurrent().Add(textInput);
+ application.SendNotification();
+ application.Render();
+
+ textInput.SetFadeBoundary( fadeBoundary );
+
+ TextView::FadeBoundary fadeBoundary2 = textInput.GetFadeBoundary();
+
+ DALI_TEST_EQUALS( fadeBoundary.mLeft, fadeBoundary2.mLeft, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeBoundary.mRight, fadeBoundary2.mRight, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeBoundary.mTop, fadeBoundary2.mTop, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeBoundary.mBottom, fadeBoundary2.mBottom, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextInputSetAndGetWidthExceedPolicy(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextInputSetAndGetWidthExceedPolicy: ");
+
+ const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::Split, TextView::ShrinkToFit };
+ const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int );
+
+ TextInput textInput = TextInput::New();
+ textInput.SetInitialText( "Hello world!" );
+
+ for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex )
+ {
+ textInput.SetWidthExceedPolicy( EXCEED_POLICIES[epIndex] );
+
+ DALI_TEST_EQUALS( textInput.GetWidthExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextInputSetAndGetHeightExceedPolicy(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextInputSetAndGetHeightExceedPolicy: ");
+
+ const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::ShrinkToFit };
+ const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int );
+
+ TextInput textInput = TextInput::New();
+ textInput.SetInitialText( "Hello world!" );
+
+ for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex )
+ {
+ textInput.SetHeightExceedPolicy( EXCEED_POLICIES[epIndex] );
+
+ DALI_TEST_EQUALS( textInput.GetHeightExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextInputScroll(void)
+{
+ tet_infoline("UtcDaliTextInputScroll: ");
+ ToolkitTestApplication application;
+
+ // Avoids the frame buffer texture to throw an exception.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ TextInput view = TextInput::New();
+ view.SetMultilinePolicy( TextView::SplitByNewLineChar );
+ view.SetWidthExceedPolicy( TextView::Original );
+ view.SetHeightExceedPolicy( TextView::Original );
+ view.SetTextAlignment( static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ) );
+ view.SetInitialText( "Hello world! This is a scroll test." );
+ view.SetSize( 100.f, 100.f );
+ view.SetSnapshotModeEnabled( false );
+
+ Stage::GetCurrent().Add( view );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( !view.IsScrollEnabled() ); // Scroll should be disabled by default.
+
+ view.SetScrollEnabled( true );
+
+ DALI_TEST_CHECK( view.IsScrollEnabled() );
+ DALI_TEST_CHECK( view.IsSnapshotModeEnabled() ); // Scroll should enable snapshot mode.
+
+ view.SetScrollPosition( Vector2( 400.f, 400.f ) );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector2& scrollPosition = view.GetScrollPosition();
+ DALI_TEST_EQUALS( scrollPosition, Vector2( 149.153656f, 0.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ END_TEST;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void utc_dali_toolkit_text_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_text_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+const char* const PROPERTY_TEXT = "text";
+const char* const PROPERTY_MULTILINE_POLICY = "multiline-policy";
+const char* const PROPERTY_WIDTH_EXCEED_POLICY = "width-exceed-policy";
+const char* const PROPERTY_HEIGHT_EXCEED_POLICY = "height-exceed-policy";
+const char* const PROPERTY_LINE_JUSTIFICATION = "line-justification";
+const char* const PROPERTY_FADE_BOUNDARY_LEFT = "fade-boundary-left";
+const char* const PROPERTY_FADE_BOUNDARY_RIGHT = "fade-boundary-right";
+const char* const PROPERTY_FADE_BOUNDARY_TOP = "fade-boundary-top";
+const char* const PROPERTY_FADE_BOUNDARY_BOTTOM = "fade-boundary-bottom";
+const char* const PROPERTY_LINE_HEIGHT_OFFSET = "line-height-offset";
+const char* const PROPERTY_HORIZONTAL_ALIGNMENT = "horizontal-alignment";
+const char* const PROPERTY_VERTICAL_ALIGNMENT = "vertical-alignment";
+
+bool TestEqual( float x, float y )
+{
+ return !( fabsf( x - y ) > Math::MACHINE_EPSILON_1000 );
+}
+
+static bool gObjectCreatedCallBackCalled;
+static unsigned int gNumberObjectCreated;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+ ++gNumberObjectCreated;
+}
+
+static bool gTextScrolled;
+static Vector2 gScrollDelta;
+static void TestTextScrolled( TextView textView, Vector2 scrollDelta )
+{
+ gTextScrolled = true;
+ gScrollDelta = scrollDelta;
+}
+
+} // namespace
+
+
+int UtcDaliTextViewNew(void)
+{
+ tet_infoline("UtcDaliTextViewNew: ");
+ ToolkitTestApplication application;
+
+ // Test default constructor.
+ TextView view;
+
+ DALI_TEST_CHECK( !view );
+
+ // Test default initialization.
+ view = TextView::New();
+
+ DALI_TEST_CHECK( view );
+
+ // Test copy constructor and asignment operator.
+ TextView viewCopy1;
+
+ viewCopy1 = view;
+
+ DALI_TEST_CHECK( viewCopy1 );
+
+ TextView viewCopy2( view );
+
+ DALI_TEST_CHECK( viewCopy2 );
+
+ // Test down cast.
+ Actor actorView;
+
+ actorView = view;
+
+ TextView downCastView = TextView::DownCast( actorView );
+
+ DALI_TEST_CHECK( downCastView );
+
+ // Test constructor with a given text.
+
+ const std::string text( "Hello world!" );
+
+ const float DESCENDER = 8.0f;
+
+ TextView view1 = TextView::New( text );
+
+ DALI_TEST_EQUALS( view1.GetText(), text, TEST_LOCATION );
+
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( text, styledText, true );
+
+ TextView view2 = TextView::New( styledText );
+
+ DALI_TEST_EQUALS( view2.GetText(), text, TEST_LOCATION );
+
+ // Check the default Toolkit::TextView::CharacterLayoutInfo::CharacterLayoutInfo() to increase coverage.
+ TextView::CharacterLayoutInfo characterLayoutInfo;
+
+ DALI_TEST_EQUALS( characterLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mPosition, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mIsNewLineChar, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mIsRightToLeftCharacter, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mIsVisible, true, TEST_LOCATION );
+
+ TextView::CharacterLayoutInfo characterLayoutInfo2( Size( 2.f, 2.f ),
+ Vector3( 3.f, 4.f, 5.f ),
+ true,
+ true,
+ false,
+ DESCENDER );
+
+ characterLayoutInfo = characterLayoutInfo2;
+
+ DALI_TEST_EQUALS( characterLayoutInfo.mSize, Size( 2.f, 2.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mPosition, Vector3( 3.f, 4.f, 5.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mIsNewLineChar, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mIsRightToLeftCharacter, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mIsVisible, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mDescender, DESCENDER , TEST_LOCATION );
+
+
+ TextView::CharacterLayoutInfo characterLayoutInfo3( characterLayoutInfo );
+
+ DALI_TEST_EQUALS( characterLayoutInfo3.mSize, Size( 2.f, 2.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo3.mPosition, Vector3( 3.f, 4.f, 5.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo3.mIsNewLineChar, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo3.mIsRightToLeftCharacter, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo3.mIsVisible, false, TEST_LOCATION );
+
+ // Check the default Toolkit::TextView::TextLayoutInfo::TextLayoutInfo() to increase coverage.
+
+ TextView::TextLayoutInfo textLayoutInfo;
+ DALI_TEST_EQUALS( textLayoutInfo.mCharacterLayoutInfoTable.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mCharacterLogicalToVisualMap.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mCharacterVisualToLogicalMap.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mTextSize, Size::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mScrollOffset, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ textLayoutInfo.mCharacterLayoutInfoTable.push_back( characterLayoutInfo );
+ textLayoutInfo.mCharacterLogicalToVisualMap.push_back( 1 );
+ textLayoutInfo.mCharacterVisualToLogicalMap.push_back( 1 );
+ textLayoutInfo.mTextSize = Size( 10.f, 10.f );
+ textLayoutInfo.mScrollOffset = Vector2( 5.f, 5.f );
+
+ TextView::TextLayoutInfo textLayoutInfo2( textLayoutInfo );
+
+ DALI_TEST_EQUALS( textLayoutInfo2.mCharacterLayoutInfoTable.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mCharacterLogicalToVisualMap.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mCharacterVisualToLogicalMap.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mTextSize, Size( 10.f, 10.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mScrollOffset, Vector2( 5.f, 5.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ TextView::TextLayoutInfo textLayoutInfo3;
+
+ textLayoutInfo3 = textLayoutInfo2;
+
+ DALI_TEST_EQUALS( textLayoutInfo3.mCharacterLayoutInfoTable.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo3.mCharacterLogicalToVisualMap.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo3.mCharacterVisualToLogicalMap.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo3.mTextSize, Size( 10.f, 10.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo3.mScrollOffset, Vector2( 5.f, 5.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ TextView view = TextView::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliTextViewSetAndGetText(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetText: ");
+ ToolkitTestApplication application;
+
+ TextView view = TextView::New();
+ view.SetSnapshotModeEnabled( false ); // Disables offscreen rendering.
+
+ std::string str( "Text with differing aCeNdEr and dEcEnDeR" );
+
+ view.SetText( str );
+ DALI_TEST_EQUALS( view.GetText(), str, TEST_LOCATION );
+
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( str, styledText, true );
+
+ view.SetText( styledText );
+ DALI_TEST_EQUALS( view.GetText(), str, TEST_LOCATION );
+
+ // Test the number of text actor created.
+
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gNumberObjectCreated = 0;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+
+ // Following string should create three text-actors ([Hel], [lo wo] and [rld]).
+ std::string text( "Hel<font size='10'>lo wo</font>rld!\n"
+ "\n" );
+
+ Stage::GetCurrent().Add( view );
+ view.SetText( text );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( 3u, gNumberObjectCreated, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewSetStyleToCurrentText(void)
+{
+ tet_infoline("UtcDaliTextViewSetStyleToCurrentText: ");
+ ToolkitTestApplication application;
+
+ TextStyle style;
+ style.SetItalics( true );
+
+ const std::string text( "앞서 농식품부 주이석 검역검사본부\n"
+ "동물방역부장을 단장으로 하는\n"
+ "민관합동조사단은 지난달 30일부터\n"
+ "12일간의 현지 조사활동을 마치고\n"
+ "11일 새벽 귀국했습니다." );
+ TextView view = TextView::New( text );
+
+ bool fail = false;
+ try
+ {
+ view.SetStyleToCurrentText( style );
+ }
+ catch( ... )
+ {
+ tet_printf( "Tet case fails\n" );
+ fail = true;
+ tet_result(TET_FAIL);
+ }
+
+ DALI_TEST_CHECK( !fail );
+ END_TEST;
+}
+
+int UtcDaliTextViewSetAndGetLineHeight(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetLineHeight: ");
+
+ ToolkitTestApplication application;
+
+ const float lineHeightOffset( 9.f );
+
+ TextView textView = TextView::New();
+
+ textView.SetLineHeightOffset( PointSize( lineHeightOffset ) );
+
+ DALI_TEST_EQUALS( float(textView.GetLineHeightOffset()), lineHeightOffset, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewSetAndGetFadeBoundary(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetFadeBoundary: ");
+
+ ToolkitTestApplication application;
+
+ TextView::FadeBoundary fadeBoundary( PixelSize( 0 ), PixelSize( 20 ), PixelSize( 0 ), PixelSize( 10 ) );
+
+ TextView textView = TextView::New( "Hello world!" );
+
+ textView.SetFadeBoundary( fadeBoundary );
+
+ TextView::FadeBoundary fadeBoundary2 = textView.GetFadeBoundary();
+
+ DALI_TEST_EQUALS( fadeBoundary.mLeft, fadeBoundary2.mLeft, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeBoundary.mRight, fadeBoundary2.mRight, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeBoundary.mTop, fadeBoundary2.mTop, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeBoundary.mBottom, fadeBoundary2.mBottom, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewSetAndGetEllipsizeText(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetEllipsizeText: ");
+
+ ToolkitTestApplication application;
+
+ TextView textView = TextView::New( "Hello world!" );
+
+ textView.SetEllipsizeText( std::string( "..." ) );
+
+ DALI_TEST_EQUALS( std::string( "..." ), textView.GetEllipsizeText(), TEST_LOCATION );
+
+ Toolkit::MarkupProcessor::StyledTextArray styledTextArray;
+
+ GetStyledTextArray( std::string( "..." ), styledTextArray, true );
+
+ textView.SetEllipsizeText( styledTextArray );
+
+ DALI_TEST_EQUALS( std::string( "..." ), textView.GetEllipsizeText(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTextViewSetAndGetWidthExceedPolicy(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetWidthExceedPolicy: ");
+
+ ToolkitTestApplication application;
+
+ const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::Split, TextView::ShrinkToFit };
+ const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int );
+
+ TextView textView = TextView::New( "Hello world!" );
+
+ for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex )
+ {
+ textView.SetWidthExceedPolicy( EXCEED_POLICIES[epIndex] );
+
+ DALI_TEST_EQUALS( textView.GetWidthExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextViewSetAndGetHeightExceedPolicy(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetHeightExceedPolicy: ");
+
+ ToolkitTestApplication application;
+
+ const TextView::ExceedPolicy EXCEED_POLICIES[] = { TextView::Original, TextView::Fade, TextView::ShrinkToFit };
+ const unsigned int NUM_EXCEED_POLICIES = sizeof( EXCEED_POLICIES ) / sizeof( unsigned int );
+
+ TextView textView = TextView::New( "Hello world!" );
+
+ for( unsigned int epIndex = 0; epIndex < NUM_EXCEED_POLICIES; ++epIndex )
+ {
+ textView.SetHeightExceedPolicy( EXCEED_POLICIES[epIndex] );
+
+ DALI_TEST_EQUALS( textView.GetHeightExceedPolicy(), EXCEED_POLICIES[epIndex], TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextViewTestLayoutOptions01(void)
+{
+ tet_infoline("UtcDaliTextViewTestLayoutOptions01: ");
+
+ ToolkitTestApplication application;
+
+ const std::string text( "앞서 농식품부 주이석 검역검사본부\n"
+ "동물방역부장을 단장으로 하는\n"
+ "민관합동조사단은 지난달 30일부터\n"
+ "12일간의 현지 조사활동을 마치고\n"
+ "11일 새벽 귀국했습니다." );
+
+ const TextView::MultilinePolicy MULTILINE_POLICIES[] = { TextView::SplitByNewLineChar, TextView::SplitByWord, TextView::SplitByChar };
+ const TextView::ExceedPolicy EXCEED_WIDTH_POLICIES[] = { TextView::Original, TextView::Fade, TextView::Split, TextView::ShrinkToFit, TextView::EllipsizeEnd };
+ const TextView::ExceedPolicy EXCEED_HEIGHT_POLICIES[] = { TextView::Original, TextView::Fade, TextView::ShrinkToFit };
+ const Alignment::Type TEXT_ALIGNMENT[] = { static_cast<Alignment::Type>( Alignment::HorizontalLeft | Alignment::VerticalTop ),
+ static_cast<Alignment::Type>( Alignment::HorizontalLeft | Alignment::VerticalCenter ),
+ static_cast<Alignment::Type>( Alignment::HorizontalLeft | Alignment::VerticalBottom ),
+ static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalTop ),
+ static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalCenter ),
+ static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalBottom ),
+ static_cast<Alignment::Type>( Alignment::HorizontalRight | Alignment::VerticalTop ),
+ static_cast<Alignment::Type>( Alignment::HorizontalRight | Alignment::VerticalCenter ),
+ static_cast<Alignment::Type>( Alignment::HorizontalRight | Alignment::VerticalBottom ) };
+ const TextView::LineJustification LINE_JUSTIFICATION[] = { TextView::Left, TextView::Center, TextView::Right, TextView::Justified };
+
+ const unsigned int NUM_MULTILINE_POLICIES = sizeof( MULTILINE_POLICIES ) / sizeof( unsigned int );
+ const unsigned int NUM_WIDTH_EXCEED_POLICIES = sizeof( EXCEED_WIDTH_POLICIES ) / sizeof( unsigned int );
+ const unsigned int NUM_HEIGHT_EXCEED_POLICIES = sizeof( EXCEED_HEIGHT_POLICIES ) / sizeof( unsigned int );
+ const unsigned int NUM_TEXT_ALIGNMENT = sizeof( TEXT_ALIGNMENT ) / sizeof( unsigned int );
+ const unsigned int NUM_LINE_JUSTIFICATION = sizeof( LINE_JUSTIFICATION ) / sizeof( unsigned int );
+
+ TextView textView = TextView::New( text );
+ textView.SetSnapshotModeEnabled( false ); // Disables offscreen rendering.
+
+ Stage::GetCurrent().Add( textView );
+
+ TextView::TextLayoutInfo textLayoutInfo;
+
+ for( unsigned int mlpIndex = 0; mlpIndex < NUM_MULTILINE_POLICIES; ++mlpIndex )
+ {
+ textView.SetMultilinePolicy( MULTILINE_POLICIES[mlpIndex] );
+ for( unsigned int ewpIndex = 0; ewpIndex < NUM_WIDTH_EXCEED_POLICIES; ++ewpIndex )
+ {
+ textView.SetWidthExceedPolicy( EXCEED_WIDTH_POLICIES[ewpIndex] );
+ for( unsigned int ehpIndex = 0; ehpIndex < NUM_HEIGHT_EXCEED_POLICIES; ++ehpIndex )
+ {
+ textView.SetHeightExceedPolicy( EXCEED_HEIGHT_POLICIES[ehpIndex] );
+ for( unsigned int taIndex = 0; taIndex < NUM_TEXT_ALIGNMENT; ++taIndex )
+ {
+ textView.SetTextAlignment( TEXT_ALIGNMENT[taIndex] );
+ for( unsigned int ljIndex = 0; ljIndex < NUM_LINE_JUSTIFICATION; ++ljIndex )
+ {
+ textView.SetLineJustification( LINE_JUSTIFICATION[ljIndex] );
+
+ try
+ {
+ textView.GetTextLayoutInfo( textLayoutInfo );
+
+ application.SendNotification();
+ application.Render();
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextView::CombineExceedPolicies() Invalid width and height exceed policies combination\"", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf( "Tet case fails\n" );
+ tet_printf( " MultilinePolicy : %d\n", MULTILINE_POLICIES[mlpIndex] );
+ tet_printf( " Width ExceedPolicy : %d\n", EXCEED_WIDTH_POLICIES[ewpIndex] );
+ tet_printf( " Height ExceedPolicy : %d\n", EXCEED_HEIGHT_POLICIES[ehpIndex] );
+ tet_printf( " TextAlignment : %d\n", TEXT_ALIGNMENT[taIndex] );
+ tet_printf( " LineJustification : %d\n", LINE_JUSTIFICATION[ljIndex] );
+ tet_result(TET_FAIL);
+ }
+
+ DALI_TEST_CHECK( LINE_JUSTIFICATION[ljIndex] == textView.GetLineJustification() );
+ }
+ DALI_TEST_CHECK( TEXT_ALIGNMENT[taIndex] == textView.GetTextAlignment() );
+ }
+ DALI_TEST_CHECK( EXCEED_HEIGHT_POLICIES[ehpIndex] == textView.GetHeightExceedPolicy() );
+ }
+ DALI_TEST_CHECK( EXCEED_WIDTH_POLICIES[ewpIndex] == textView.GetWidthExceedPolicy() );
+ }
+ DALI_TEST_CHECK( MULTILINE_POLICIES[mlpIndex] == textView.GetMultilinePolicy() );
+ }
+ END_TEST;
+}
+
+int UtcDaliTextViewTestLayoutOptions02(void)
+{
+ tet_infoline("UtcDaliTextViewTestLayoutOptions02: ");
+ ToolkitTestApplication application;
+
+ // Check some configurations.
+
+ TextView textView = TextView::New();
+ textView.SetSnapshotModeEnabled( false ); // Disables offscreen rendering.
+
+ Stage::GetCurrent().Add( textView );
+
+ // SplitByWord and ShrinkToFit.
+ // Centered alignment.
+ // Centered justification.
+ // Don't create a text actor per character.
+
+ textView.SetMultilinePolicy( TextView::SplitByWord );
+ textView.SetWidthExceedPolicy( TextView::ShrinkToFit );
+ textView.SetHeightExceedPolicy( TextView::ShrinkToFit );
+ textView.SetTextAlignment( static_cast<Alignment::Type>( Alignment::HorizontalCenter | Alignment::VerticalTop ) );
+ textView.SetLineJustification( TextView::Center );
+ textView.SetSize( 136.56252f, 100.f );
+
+ textView.SetText( "Hel<font color='green'>lo wo</font>rld!" );
+
+ application.SendNotification();
+ application.Render();
+
+ std::vector<Size> 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<Vector3> 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::Type>( Alignment::HorizontalCenter | Alignment::VerticalCenter ) );
+ textView.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed );
+ textView.SetLineJustification( Toolkit::TextView::Left );
+
+ application.SendNotification();
+ application.Render();
+
+ sizes.clear();
+ sizes.push_back( Size( 24.999999f, 8.333333f ) ); //
+ sizes.push_back( Size( 24.999999f, 8.333333f ) ); //
+ sizes.push_back( Size( 16.666666f, 8.333333f ) ); // Longest word is 'world!' (6 characters x 11.380210) which doesn't fit in the 50x50 box.
+ sizes.push_back( Size( 33.333332f, 8.333333f ) ); // The scale factor is 0.732265339, so the character size is 8.333333.
+ // Text should be split in two lines, centered in the vertical dimension and fitted in the horizontal one.
+ positions.clear(); // As shown below, the text is two lines and centered in the vertical dimension and
+ positions.push_back( Vector3( 0.000008f, 25.223114f, 0.f ) ); // it should start in middle height (~25).
+ positions.push_back( Vector3( 24.999999f, 25.223114f, 0.f ) ); // ______
+ positions.push_back( Vector3( 0.000006f, 33.556446f, 0.f ) ); // | |
+ positions.push_back( Vector3( 16.666666f, 33.556446f, 0.f ) ); // |Hello |
+ // |world!|
+ // |______|
+ //
+
+ DALI_TEST_CHECK( positions.size() == textView.GetChildCount() ); // Check text has two text-actors.
+
+ for( std::size_t index = 0, num = textView.GetChildCount(); index < num; ++index )
+ {
+ const Vector3& size = textView.GetChildAt(index).GetCurrentSize();
+ const Vector3& position = textView.GetChildAt(index).GetCurrentPosition();
+
+ DALI_TEST_EQUALS( size.width, sizes[index].width, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, sizes[index].height, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( position.width, positions[index].width, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( position.height, positions[index].height, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ }
+
+ // TODO: Add more tests when TextView implementation is finished.
+ END_TEST;
+}
+
+int UtcDaliTextViewInsertRemoveText(void)
+{
+ tet_infoline("UtcDaliTextViewInsertRemoveText: ");
+ ToolkitTestApplication application;
+
+ std::string text("Hello ");
+
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( text, styledText, true );
+
+ TextView view = TextView::New( "world!" );
+
+ view.InsertTextAt( 0, styledText );
+
+ DALI_TEST_EQUALS( view.GetText(), std::string("Hello world!"), TEST_LOCATION );
+
+ view.RemoveTextFrom( 4, 5 );
+
+ DALI_TEST_EQUALS( view.GetText(), std::string("Hellld!"), TEST_LOCATION );
+
+ view.InsertTextAt( 0, "Hello " );
+
+ DALI_TEST_EQUALS( view.GetText(), std::string("Hello Hellld!"), TEST_LOCATION );
+
+
+ view.InsertTextAt( 0, "Hello " );
+ view.InsertTextAt( 0, "Hello " );
+ view.InsertTextAt( 0, "Hello " );
+ view.InsertTextAt( 0, "Hello " );
+ view.RemoveTextFrom( 4, 2 );
+ view.RemoveTextFrom( 4, 2 );
+ view.RemoveTextFrom( 4, 2 );
+ view.RemoveTextFrom( 4, 2 );
+ view.RemoveTextFrom( 4, 2 );
+ view.SetText( "Hello world!" );
+
+ DALI_TEST_EQUALS( view.GetText(), std::string("Hello world!"), TEST_LOCATION );
+
+ view.ReplaceTextFromTo( 5, 1, "" );
+
+ DALI_TEST_EQUALS( view.GetText(), std::string("Helloworld!"), TEST_LOCATION );
+
+ view.ReplaceTextFromTo( 0, 11, styledText );
+
+ DALI_TEST_EQUALS( view.GetText(), std::string("Hello "), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewSnapshotEnable(void)
+{
+ tet_infoline("UtcDaliTextViewSnapshotEnable: ");
+ ToolkitTestApplication application;
+
+ // Avoids the frame buffer texture to throw an exception.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ TextView view = TextView::New( "Hel<font color='green'>lo world!</font> This <font color='green'>is</font> a sna<font color='green'>psho</font>t test." );
+
+ Stage::GetCurrent().Add( view );
+
+ view.SetSnapshotModeEnabled( true ); // VCC. By default the snapshot mode should be enabled but it has been temporary disabled.
+ // This line should be removed when text-view is set to use the snapshot mode by default.
+
+ // Snapshot is enabled by default.
+ DALI_TEST_CHECK( view.IsSnapshotModeEnabled() );
+
+ application.SendNotification();
+ application.Render();
+
+ // TextView should have only two actors:
+ // the root (Actor) and the image (ImageActor).
+
+ DALI_TEST_EQUALS( view.GetChildCount(), 2u, TEST_LOCATION );
+
+ view.SetSnapshotModeEnabled( false );
+ DALI_TEST_CHECK( !view.IsSnapshotModeEnabled() );
+
+ application.SendNotification();
+ application.Render();
+
+ // TextView should have one text-actor per word.
+
+ DALI_TEST_EQUALS( view.GetChildCount(), 7u, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewScroll(void)
+{
+ tet_infoline("UtcDaliTextViewScroll: ");
+ ToolkitTestApplication application;
+
+ // Avoids the frame buffer texture to throw an exception.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ TextView view = TextView::New( "Hello world! This is a scroll test." );
+ view.SetSize( 100.f, 100.f );
+ view.SetSnapshotModeEnabled( false );
+
+ Stage::GetCurrent().Add( view );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( !view.IsScrollEnabled() ); // Scroll should be disabled by default.
+
+ view.SetScrollEnabled( true );
+ view.ScrolledSignal().Connect( &TestTextScrolled );
+
+ DALI_TEST_CHECK( view.IsScrollEnabled() );
+ DALI_TEST_CHECK( view.IsSnapshotModeEnabled() ); // Scroll should enable snapshot mode.
+
+ gTextScrolled = false;
+ gScrollDelta = Vector2::ZERO;
+ view.SetScrollPosition( Vector2( 400.f, 400.f ) );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector2& scrollPosition = view.GetScrollPosition();
+ DALI_TEST_EQUALS( scrollPosition, Vector2( 149.153656f, 0.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ DALI_TEST_CHECK( gTextScrolled );
+ DALI_TEST_EQUALS( gScrollDelta, Vector2( 149.153656f, 0.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ DALI_TEST_CHECK( view.IsScrollPositionTrimmed() );
+ END_TEST;
+}
+
+int UtcDaliTextViewSetProperty(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetText: ");
+ ToolkitTestApplication application;
+
+ TextView view = TextView::New( "Hello world!" );
+ Stage::GetCurrent().Add( view );
+
+ //Test multiline policy property
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_MULTILINE_POLICY), "SplitByNewLineChar");
+ DALI_TEST_CHECK( Toolkit::TextView::SplitByNewLineChar == view.GetMultilinePolicy() );
+
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_MULTILINE_POLICY), "SplitByWord");
+ DALI_TEST_CHECK( Toolkit::TextView::SplitByWord == view.GetMultilinePolicy() );
+
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_MULTILINE_POLICY), "SplitByChar");
+ DALI_TEST_CHECK( Toolkit::TextView::SplitByChar == view.GetMultilinePolicy() );
+
+ //Test width exceed policy property
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_WIDTH_EXCEED_POLICY), "Original");
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_HEIGHT_EXCEED_POLICY), "Original");
+ DALI_TEST_CHECK( Toolkit::TextView::Original == view.GetWidthExceedPolicy() );
+ DALI_TEST_CHECK( Toolkit::TextView::Original == view.GetHeightExceedPolicy() );
+
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_WIDTH_EXCEED_POLICY), "Fade");
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_HEIGHT_EXCEED_POLICY), "Fade");
+ DALI_TEST_CHECK( Toolkit::TextView::Fade == view.GetWidthExceedPolicy() );
+ DALI_TEST_CHECK( Toolkit::TextView::Fade == view.GetHeightExceedPolicy() );
+
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_WIDTH_EXCEED_POLICY), "ShrinkToFit");
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_HEIGHT_EXCEED_POLICY), "ShrinkToFit");
+ DALI_TEST_CHECK( Toolkit::TextView::ShrinkToFit == view.GetWidthExceedPolicy() );
+ DALI_TEST_CHECK( Toolkit::TextView::ShrinkToFit == view.GetHeightExceedPolicy() );
+
+ //Test line justification property
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_JUSTIFICATION), "Left");
+ DALI_TEST_CHECK( Toolkit::TextView::Left == view.GetLineJustification() );
+
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_JUSTIFICATION), "Center");
+ DALI_TEST_CHECK( Toolkit::TextView::Center == view.GetLineJustification() );
+
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_JUSTIFICATION), "Right");
+ DALI_TEST_CHECK( Toolkit::TextView::Right == view.GetLineJustification() );
+
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_JUSTIFICATION), "Justified");
+ DALI_TEST_CHECK( Toolkit::TextView::Justified == view.GetLineJustification() );
+
+ //Test fade boundary property
+ unsigned int testValue = 23;
+ PixelSize leftFadeBoundary(testValue);
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_LEFT), testValue);
+ DALI_TEST_CHECK( leftFadeBoundary == view.GetFadeBoundary().mLeft );
+
+ testValue = 26;
+ PixelSize rightFadeBoundary(testValue);
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_RIGHT), testValue);
+ DALI_TEST_CHECK( rightFadeBoundary == view.GetFadeBoundary().mRight );
+
+ testValue = 2;
+ PixelSize topFadeBoundary(testValue);
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_TOP), testValue);
+ DALI_TEST_CHECK( topFadeBoundary == view.GetFadeBoundary().mTop );
+
+ testValue = 11;
+ PixelSize bottomFadeBoundary(testValue);
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_FADE_BOUNDARY_BOTTOM), testValue);
+ DALI_TEST_CHECK( bottomFadeBoundary == view.GetFadeBoundary().mBottom );
+
+ //Test Line height offset property
+ float testOffsetValue = 14.04f;
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_LINE_HEIGHT_OFFSET), testOffsetValue);
+ DALI_TEST_CHECK( PointSize(testOffsetValue) == view.GetLineHeightOffset() );
+
+ //Test alignment property
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_HORIZONTAL_ALIGNMENT), "HorizontalLeft");
+ view.SetProperty(view.GetPropertyIndex(PROPERTY_VERTICAL_ALIGNMENT), "VerticalTop");
+ DALI_TEST_CHECK( (Toolkit::Alignment::HorizontalLeft | Toolkit::Alignment::VerticalTop) == view.GetTextAlignment() );
+ END_TEST;
+}
+
+int UtcDaliTextViewSetSortModifier(void)
+{
+ tet_infoline("UtcDaliTextViewSetAndGetText: ");
+ ToolkitTestApplication application;
+
+ TextView view = TextView::New( "Hello world!" );
+ Stage::GetCurrent().Add( view );
+
+ view.SetSortModifier( 10.f );
+ view.SetSnapshotModeEnabled( false );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( RenderableActor::DownCast(view.GetChildAt(0)).GetSortModifier(), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTextViewUnderlineText(void)
+{
+ tet_infoline("UtcDaliTextViewUnderlineText: ");
+ ToolkitTestApplication application;
+
+ TextView textView = TextView::New( "<u><font size='10'>gg<font size='14'>gg<font size='18'>gg<font size='22'>gg</font>gg</font>gg</font>gg</font></u>" );
+ textView.SetSnapshotModeEnabled( false );
+
+ textView.SetSize( 150.f, 100.f );
+
+ Stage::GetCurrent().Add( textView );
+
+ application.SendNotification();
+ application.Render();
+
+ std::vector<float> positions;
+ positions.push_back( 6.448784f );
+ positions.push_back( 9.862847f );
+ positions.push_back( 13.276909f );
+ positions.push_back( 16.690973f );
+ positions.push_back( 13.276909f );
+ positions.push_back( 9.862847f );
+ positions.push_back( 6.448784f );
+
+ for( std::size_t index = 0, num = textView.GetChildCount(); index < num; ++index )
+ {
+ TextStyle style = TextActor::DownCast( textView.GetChildAt(index) ).GetTextStyle();
+
+ DALI_TEST_EQUALS( 4.17274f, style.GetUnderlineThickness(), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( positions[index], style.GetUnderlinePosition(), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ }
+ END_TEST;
+}
--- /dev/null
+function getScrollTop() {
+ return f_scrollTop();
+}
+
+function f_scrollTop() {
+ return f_filterResults($(window) ? $(window).scrollTop() : 0,
+ document.documentElement ? document.documentElement.scrollTop : 0,
+ document.body ? document.body.scrollTop : 0);
+}
+function f_filterResults(n_win, n_docel, n_body) {
+ var n_result = n_win ? n_win : 0;
+ if (n_docel && (!n_result || (n_result > n_docel)))
+ n_result = n_docel;
+ return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
+}
+
+function setScrollTop() {
+ $(window) ? $(window).scrollTop(0) : 0;
+ document.documentElement ? document.documentElement.scrollTop = 0 : 0;
+ document.body ? document.body.scrollTop = 0 : 0;
+}
+
+function goTopEx() {
+ $node = $('#goTopBtn');
+ if (getScrollTop() > 0) {
+ $node.show();
+ } else {
+ $node.hide();
+ }
+
+ $(window).scroll(function() {
+ if (getScrollTop() > 0) {
+ $node.show();
+ } else {
+ $node.hide();
+ }
+ });
+
+ $node.click(function() {
+ setScrollTop();
+ });
+}
+
+function drawRatio() {
+ $('.suite_item').each(function(i, node) {
+ drawSuiteRatio(node)
+ });
+}
+
+$(".see_all").click(function(){
+ $("#see_all").show();
+ $("#see_fail").hide();
+ $("#see_block").hide();
+ $("#see_na").hide();
+ updateToggles();
+ return false;
+});
+
+$(".see_failed").click(function(){
+ $("#see_all").hide();
+ $("#see_fail").show();
+ $("#see_block").hide();
+ $("#see_na").hide();
+ updateToggles();
+ return false;
+});
+
+$(".see_blocked").click(function(){
+ $("#see_all").hide();
+ $("#see_fail").hide();
+ $("#see_block").show();
+ $("#see_na").hide();
+ updateToggles();
+ return false;
+});
+
+$(".see_na").click(function(){
+ $("#see_all").hide();
+ $("#see_fail").hide();
+ $("#see_block").hide();
+ $("#see_na").show();
+ updateToggles();
+ return false;
+});
+
+$("a.test_case_popup").click(function(){
+ var $this = $(this);
+ Popup.show($this.attr('id'));
+ return false;
+});
+
+$(".see_capabilities").click(function(){
+ if ($('#capability_table').css('display') == 'none') {
+ $("#capability_table").show();
+ }else{
+ $("#capability_table").hide();
+ }
+ return false;
+});
+
+function drawSuiteRatio(node) {
+ arrTitle = new Array("Passed", "Failed", "Blocked", "Not Executed");
+ var $node = $(node);
+ var $total = $node.find('.total');
+ var $pass = $node.find('.pass');
+ var $fail = $node.find('.fail');
+ var $block = $node.find('.block');
+ var $na = $node.find('.na');
+ var $div = $node.find('.RatioGraphic');
+
+ var total_int = parseInt($total.text());
+ var pass_int = parseInt($pass.text());
+ var fail_int = parseInt($fail.text());
+ var block_int = parseInt($block.text());
+ var na_int = parseInt($na.text());
+
+ var pass_rate = pass_int * 100 / total_int;
+ var fail_rate = fail_int * 100 / total_int;
+ var block_rate = block_int * 100 / total_int;
+ var na_rate = na_int * 100 / total_int;
+
+ var areaWidth = 380;
+
+ var pass_width = areaWidth * pass_rate / 100;
+ var fail_width = areaWidth * fail_rate / 100;
+ var block_width = areaWidth * block_rate / 100;
+ var na_width = areaWidth * na_rate / 100;
+
+ pass_rate = pass_rate.toFixed(2);
+ fail_rate = fail_rate.toFixed(2);
+ block_rate = block_rate.toFixed(2);
+ na_rate = na_rate.toFixed(2);
+
+ var pass_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/blue.jpg");"
+ var fail_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/red.jpg");"
+ var block_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/orange.jpg");"
+ var na_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/gray.jpg");"
+
+ var html = "<table width=\"380.68\" align=\"center\"><tbody><tr>";
+ if (pass_width > 0){
+ html += "<td width=\""
+ + pass_width
+ + "\" style=\""
+ + pass_style
+ + "\" title=\"Passed :"
+ + pass_rate
+ + "%\">";
+ if (pass_width > 20){
+ html += pass_rate + "%"
+ }
+ html += "</td>";
+ }
+ if (fail_width > 0){
+ html += "<td width=\""
+ + fail_width
+ + "\" style=\""
+ + fail_style
+ + "\" title=\"Failed :"
+ + fail_rate
+ + "%\">";
+ if (fail_width > 20){
+ html += fail_rate + "%"
+ }
+ html += "</td>";
+ }
+ if (block_width > 0){
+ html += "<td width=\""
+ + block_width
+ + "\" style=\""
+ + block_style
+ + "\" title=\"Blocked :"
+ + block_rate
+ + "%\">";
+ if (block_width > 20){
+ html += block_rate + "%"
+ }
+ html += "</td>";
+ }
+ if (na_width > 0){
+ html += "<td width=\""
+ + na_width
+ + "\" style=\""
+ + na_style
+ + "\" title=\"Blocked :"
+ + na_rate
+ + "%\">";
+ if (na_width > 20){
+ html += na_rate + "%"
+ }
+ html += "</td>";
+ }
+ html += "</tr></tbody></table>";
+ $div.html(html);
+}
--- /dev/null
+/*! jQuery v1.7.1 jquery.com | jquery.org/license */
+(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
+f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
+{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
\ No newline at end of file
--- /dev/null
+/**
+ * Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com)
+ *
+ * Dual licensed under the MIT and GPL licenses.
+ * This basically means you can use this code however you want for
+ * free, but don't claim to have written it yourself!
+ * Donations always accepted: http://www.JavascriptToolbox.com/donate/
+ *
+ * Please do not link to the .js files on javascripttoolbox.com from
+ * your site. Copy the files locally to your server instead.
+ *
+ */
+/* ******************************************************************* */
+/* UTIL FUNCTIONS */
+/* ******************************************************************* */
+var Util = {'$VERSION':1.06};
+
+// Util functions - these are GLOBAL so they
+// look like built-in functions.
+
+// Determine if an object is an array
+function isArray(o) {
+ return (o!=null && typeof(o)=="object" && typeof(o.length)=="number" && (o.length==0 || defined(o[0])));
+};
+
+// Determine if an object is an Object
+function isObject(o) {
+ return (o!=null && typeof(o)=="object" && defined(o.constructor) && o.constructor==Object && !defined(o.nodeName));
+};
+
+// Determine if a reference is defined
+function defined(o) {
+ return (typeof(o)!="undefined");
+};
+
+// Iterate over an array, object, or list of items and run code against each item
+// Similar functionality to Perl's map() function
+function map(func) {
+ var i,j,o;
+ var results = [];
+ if (typeof(func)=="string") {
+ func = new Function('$_',func);
+ }
+ for (i=1; i<arguments.length; i++) {
+ o = arguments[i];
+ if (isArray(o)) {
+ for (j=0; j<o.length; j++) {
+ results[results.length] = func(o[j]);
+ }
+ }
+ else if (isObject(o)) {
+ for (j in o) {
+ results[results.length] = func(o[j]);
+ }
+ }
+ else {
+ results[results.length] = func(o);
+ }
+ }
+ return results;
+};
+
+// Set default values in an object if they are undefined
+function setDefaultValues(o,values) {
+ if (!defined(o) || o==null) {
+ o = {};
+ }
+ if (!defined(values) || values==null) {
+ return o;
+ }
+ for (var val in values) {
+ if (!defined(o[val])) {
+ o[val] = values[val];
+ }
+ }
+ return o;
+};
+
+/* ******************************************************************* */
+/* DEFAULT OBJECT PROTOTYPE ENHANCEMENTS */
+/* ******************************************************************* */
+// These functions add useful functionality to built-in objects
+Array.prototype.contains = function(o) {
+ var i,l;
+ if (!(l = this.length)) { return false; }
+ for (i=0; i<l; i++) {
+ if (o==this[i]) {
+ return true;
+ }
+ }
+};
+
+/* ******************************************************************* */
+/* DOM FUNCTIONS */
+/* ******************************************************************* */
+var DOM = (function() {
+ var dom = {};
+
+ // Get a parent tag with a given nodename
+ dom.getParentByTagName = function(o,tagNames) {
+ if(o==null) { return null; }
+ if (isArray(tagNames)) {
+ tagNames = map("return $_.toUpperCase()",tagNames);
+ while (o=o.parentNode) {
+ if (o.nodeName && tagNames.contains(o.nodeName)) {
+ return o;
+ }
+ }
+ }
+ else {
+ tagNames = tagNames.toUpperCase();
+ while (o=o.parentNode) {
+ if (o.nodeName && tagNames==o.nodeName) {
+ return o;
+ }
+ }
+ }
+ return null;
+ };
+
+ // Remove a node from its parent
+ dom.removeNode = function(o) {
+ if (o!=null && o.parentNode && o.parentNode.removeChild) {
+ // First remove all attributes which are func references, to avoid memory leaks
+ for (var i in o) {
+ if (typeof(o[i])=="function") {
+ o[i] = null;
+ }
+ }
+ o.parentNode.removeChild(o);
+ return true;
+ }
+ return false;
+ };
+
+ // Get the outer width in pixels of an object, including borders, padding, and margin
+ dom.getOuterWidth = function(o) {
+ if (defined(o.offsetWidth)) {
+ return o.offsetWidth;
+ }
+ return null;
+ };
+
+ // Get the outer height in pixels of an object, including borders, padding, and margin
+ dom.getOuterHeight = function(o) {
+ if (defined(o.offsetHeight)) {
+ return o.offsetHeight;
+ }
+ return null;
+ };
+
+ // Resolve an item, an array of items, or an object of items
+ dom.resolve = function() {
+ var results = new Array();
+ var i,j,o;
+ for (var i=0; i<arguments.length; i++) {
+ var o = arguments[i];
+ if (o==null) {
+ if (arguments.length==1) {
+ return null;
+ }
+ results[results.length] = null;
+ }
+ else if (typeof(o)=='string') {
+ if (document.getElementById) {
+ o = document.getElementById(o);
+ }
+ else if (document.all) {
+ o = document.all[o];
+ }
+ if (arguments.length==1) {
+ return o;
+ }
+ results[results.length] = o;
+ }
+ else if (isArray(o)) {
+ for (j=0; j<o.length; j++) {
+ results[results.length] = o[j];
+ }
+ }
+ else if (isObject(o)) {
+ for (j in o) {
+ results[results.length] = o[j];
+ }
+ }
+ else if (arguments.length==1) {
+ return o;
+ }
+ else {
+ results[results.length] = o;
+ }
+ }
+ return results;
+ };
+ dom.$ = dom.resolve;
+
+ return dom;
+})();
+
+/* ******************************************************************* */
+/* CSS FUNCTIONS */
+/* ******************************************************************* */
+var CSS = (function(){
+ var css = {};
+
+ // Convert an RGB string in the form "rgb (255, 255, 255)" to "#ffffff"
+ css.rgb2hex = function(rgbString) {
+ if (typeof(rgbString)!="string" || !defined(rgbString.match)) { return null; }
+ var result = rgbString.match(/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*/);
+ if (result==null) { return rgbString; }
+ var rgb = +result[1] << 16 | +result[2] << 8 | +result[3];
+ var hex = "";
+ var digits = "0123456789abcdef";
+ while(rgb!=0) {
+ hex = digits.charAt(rgb&0xf)+hex;
+ rgb>>>=4;
+ }
+ while(hex.length<6) { hex='0'+hex; }
+ return "#" + hex;
+ };
+
+ // Convert hyphen style names like border-width to camel case like borderWidth
+ css.hyphen2camel = function(property) {
+ if (!defined(property) || property==null) { return null; }
+ if (property.indexOf("-")<0) { return property; }
+ var str = "";
+ var c = null;
+ var l = property.length;
+ for (var i=0; i<l; i++) {
+ c = property.charAt(i);
+ str += (c!="-")?c:property.charAt(++i).toUpperCase();
+ }
+ return str;
+ };
+
+ // Determine if an object or class string contains a given class.
+ css.hasClass = function(obj,className) {
+ if (!defined(obj) || obj==null || !RegExp) { return false; }
+ var re = new RegExp("(^|\\s)" + className + "(\\s|$)");
+ if (typeof(obj)=="string") {
+ return re.test(obj);
+ }
+ else if (typeof(obj)=="object" && obj.className) {
+ return re.test(obj.className);
+ }
+ return false;
+ };
+
+ // Add a class to an object
+ css.addClass = function(obj,className) {
+ if (typeof(obj)!="object" || obj==null || !defined(obj.className)) { return false; }
+ if (obj.className==null || obj.className=='') {
+ obj.className = className;
+ return true;
+ }
+ if (css.hasClass(obj,className)) { return true; }
+ obj.className = obj.className + " " + className;
+ return true;
+ };
+
+ // Remove a class from an object
+ css.removeClass = function(obj,className) {
+ if (typeof(obj)!="object" || obj==null || !defined(obj.className) || obj.className==null) { return false; }
+ if (!css.hasClass(obj,className)) { return false; }
+ var re = new RegExp("(^|\\s+)" + className + "(\\s+|$)");
+ obj.className = obj.className.replace(re,' ');
+ return true;
+ };
+
+ // Fully replace a class with a new one
+ css.replaceClass = function(obj,className,newClassName) {
+ if (typeof(obj)!="object" || obj==null || !defined(obj.className) || obj.className==null) { return false; }
+ css.removeClass(obj,className);
+ css.addClass(obj,newClassName);
+ return true;
+ };
+
+ // Get the currently-applied style of an object
+ css.getStyle = function(o, property) {
+ if (o==null) { return null; }
+ var val = null;
+ var camelProperty = css.hyphen2camel(property);
+ // Handle "float" property as a special case
+ if (property=="float") {
+ val = css.getStyle(o,"cssFloat");
+ if (val==null) {
+ val = css.getStyle(o,"styleFloat");
+ }
+ }
+ else if (o.currentStyle && defined(o.currentStyle[camelProperty])) {
+ val = o.currentStyle[camelProperty];
+ }
+ else if (window.getComputedStyle) {
+ val = window.getComputedStyle(o,null).getPropertyValue(property);
+ }
+ else if (o.style && defined(o.style[camelProperty])) {
+ val = o.style[camelProperty];
+ }
+ // For color values, make the value consistent across browsers
+ // Convert rgb() colors back to hex for consistency
+ if (/^\s*rgb\s*\(/.test(val)) {
+ val = css.rgb2hex(val);
+ }
+ // Lowercase all #hex values
+ if (/^#/.test(val)) {
+ val = val.toLowerCase();
+ }
+ return val;
+ };
+ css.get = css.getStyle;
+
+ // Set a style on an object
+ css.setStyle = function(o, property, value) {
+ if (o==null || !defined(o.style) || !defined(property) || property==null || !defined(value)) { return false; }
+ if (property=="float") {
+ o.style["cssFloat"] = value;
+ o.style["styleFloat"] = value;
+ }
+ else if (property=="opacity") {
+ o.style['-moz-opacity'] = value;
+ o.style['-khtml-opacity'] = value;
+ o.style.opacity = value;
+ if (defined(o.style.filter)) {
+ o.style.filter = "alpha(opacity=" + value*100 + ")";
+ }
+ }
+ else {
+ o.style[css.hyphen2camel(property)] = value;
+ }
+ return true;
+ };
+ css.set = css.setStyle;
+
+ // Get a unique ID which doesn't already exist on the page
+ css.uniqueIdNumber=1000;
+ css.createId = function(o) {
+ if (defined(o) && o!=null && defined(o.id) && o.id!=null && o.id!="") {
+ return o.id;
+ }
+ var id = null;
+ while (id==null || document.getElementById(id)!=null) {
+ id = "ID_"+(css.uniqueIdNumber++);
+ }
+ if (defined(o) && o!=null && (!defined(o.id)||o.id=="")) {
+ o.id = id;
+ }
+ return id;
+ };
+
+ return css;
+})();
+
+/* ******************************************************************* */
+/* EVENT FUNCTIONS */
+/* ******************************************************************* */
+
+var Event = (function(){
+ var ev = {};
+
+ // Resolve an event using IE's window.event if necessary
+ // --------------------------------------------------------------------
+ ev.resolve = function(e) {
+ if (!defined(e) && defined(window.event)) {
+ e = window.event;
+ }
+ return e;
+ };
+
+ // Add an event handler to a function
+ // Note: Don't use 'this' within functions added using this method, since
+ // the attachEvent and addEventListener models differ.
+ // --------------------------------------------------------------------
+ ev.add = function( obj, type, fn, capture ) {
+ if (obj.addEventListener) {
+ obj.addEventListener( type, fn, capture );
+ return true;
+ }
+ else if (obj.attachEvent) {
+ obj.attachEvent( "on"+type, fn );
+ return true;
+ }
+ return false;
+ };
+
+ // Get the mouse position of an event
+ // --------------------------------------------------------------------
+ // PageX/Y, where they exist, are more reliable than ClientX/Y because
+ // of some browser bugs in Opera/Safari
+ ev.getMouseX = function(e) {
+ e = ev.resolve(e);
+ if (defined(e.pageX)) {
+ return e.pageX;
+ }
+ if (defined(e.clientX)) {
+ return e.clientX+Screen.getScrollLeft();
+ }
+ return null;
+ };
+ ev.getMouseY = function(e) {
+ e = ev.resolve(e);
+ if (defined(e.pageY)) {
+ return e.pageY;
+ }
+ if (defined(e.clientY)) {
+ return e.clientY+Screen.getScrollTop();
+ }
+ return null;
+ };
+
+ // Stop the event from bubbling up to parent elements.
+ // Two method names map to the same function
+ // --------------------------------------------------------------------
+ ev.cancelBubble = function(e) {
+ e = ev.resolve(e);
+ if (typeof(e.stopPropagation)=="function") { e.stopPropagation(); }
+ if (defined(e.cancelBubble)) { e.cancelBubble = true; }
+ };
+ ev.stopPropagation = ev.cancelBubble;
+
+ // Prevent the default handling of the event to occur
+ // --------------------------------------------------------------------
+ ev.preventDefault = function(e) {
+ e = ev.resolve(e);
+ if (typeof(e.preventDefault)=="function") { e.preventDefault(); }
+ if (defined(e.returnValue)) { e.returnValue = false; }
+ };
+
+ return ev;
+})();
+
+/* ******************************************************************* */
+/* SCREEN FUNCTIONS */
+/* ******************************************************************* */
+var Screen = (function() {
+ var screen = {};
+
+ // Get a reference to the body
+ // --------------------------------------------------------------------
+ screen.getBody = function() {
+ if (document.body) {
+ return document.body;
+ }
+ if (document.getElementsByTagName) {
+ var bodies = document.getElementsByTagName("BODY");
+ if (bodies!=null && bodies.length>0) {
+ return bodies[0];
+ }
+ }
+ return null;
+ };
+
+ // Get the amount that the main document has scrolled from top
+ // --------------------------------------------------------------------
+ screen.getScrollTop = function() {
+ if (document.documentElement && defined(document.documentElement.scrollTop) && document.documentElement.scrollTop>0) {
+ return document.documentElement.scrollTop;
+ }
+ if (document.body && defined(document.body.scrollTop)) {
+ return document.body.scrollTop;
+ }
+ return null;
+ };
+
+ // Get the amount that the main document has scrolled from left
+ // --------------------------------------------------------------------
+ screen.getScrollLeft = function() {
+ if (document.documentElement && defined(document.documentElement.scrollLeft) && document.documentElement.scrollLeft>0) {
+ return document.documentElement.scrollLeft;
+ }
+ if (document.body && defined(document.body.scrollLeft)) {
+ return document.body.scrollLeft;
+ }
+ return null;
+ };
+
+ // Util function to default a bad number to 0
+ // --------------------------------------------------------------------
+ screen.zero = function(n) {
+ return (!defined(n) || isNaN(n))?0:n;
+ };
+
+ // Get the width of the entire document
+ // --------------------------------------------------------------------
+ screen.getDocumentWidth = function() {
+ var width = 0;
+ var body = screen.getBody();
+ if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) {
+ var rightMargin = parseInt(CSS.get(body,'marginRight'),10) || 0;
+ var leftMargin = parseInt(CSS.get(body,'marginLeft'), 10) || 0;
+ width = Math.max(body.offsetWidth + leftMargin + rightMargin, document.documentElement.clientWidth);
+ }
+ else {
+ width = Math.max(body.clientWidth, body.scrollWidth);
+ }
+ if (isNaN(width) || width==0) {
+ width = screen.zero(self.innerWidth);
+ }
+ return width;
+ };
+
+ // Get the height of the entire document
+ // --------------------------------------------------------------------
+ screen.getDocumentHeight = function() {
+ var body = screen.getBody();
+ var innerHeight = (defined(self.innerHeight)&&!isNaN(self.innerHeight))?self.innerHeight:0;
+ if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) {
+ var topMargin = parseInt(CSS.get(body,'marginTop'),10) || 0;
+ var bottomMargin = parseInt(CSS.get(body,'marginBottom'), 10) || 0;
+ return Math.max(body.offsetHeight + topMargin + bottomMargin, document.documentElement.clientHeight, document.documentElement.scrollHeight, screen.zero(self.innerHeight));
+ }
+ return Math.max(body.scrollHeight, body.clientHeight, screen.zero(self.innerHeight));
+ };
+
+ // Get the width of the viewport (viewable area) in the browser window
+ // --------------------------------------------------------------------
+ screen.getViewportWidth = function() {
+ if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) {
+ return document.documentElement.clientWidth;
+ }
+ else if (document.compatMode && document.body) {
+ return document.body.clientWidth;
+ }
+ return screen.zero(self.innerWidth);
+ };
+
+ // Get the height of the viewport (viewable area) in the browser window
+ // --------------------------------------------------------------------
+ screen.getViewportHeight = function() {
+ if (!window.opera && document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) {
+ return document.documentElement.clientHeight;
+ }
+ else if (document.compatMode && !window.opera && document.body) {
+ return document.body.clientHeight;
+ }
+ return screen.zero(self.innerHeight);
+ };
+
+ return screen;
+})();var Sort = (function(){
+ var sort = {};
+ sort.AlphaNumeric = function(a,b) {
+ if (a==b) { return 0; }
+ if (a<b) { return -1; }
+ return 1;
+ };
+
+ sort.Default = sort.AlphaNumeric;
+
+ sort.NumericConversion = function(val) {
+ if (typeof(val)!="number") {
+ if (typeof(val)=="string") {
+ val = parseFloat(val.replace(/,/g,''));
+ if (isNaN(val) || val==null) { val=0; }
+ }
+ else {
+ val = 0;
+ }
+ }
+ return val;
+ };
+
+ sort.Numeric = function(a,b) {
+ return sort.NumericConversion(a)-sort.NumericConversion(b);
+ };
+
+ sort.IgnoreCaseConversion = function(val) {
+ if (val==null) { val=""; }
+ return (""+val).toLowerCase();
+ };
+
+ sort.IgnoreCase = function(a,b) {
+ return sort.AlphaNumeric(sort.IgnoreCaseConversion(a),sort.IgnoreCaseConversion(b));
+ };
+
+ sort.CurrencyConversion = function(val) {
+ if (typeof(val)=="string") {
+ val = val.replace(/^[^\d\.]/,'');
+ }
+ return sort.NumericConversion(val);
+ };
+
+ sort.Currency = function(a,b) {
+ return sort.Numeric(sort.CurrencyConversion(a),sort.CurrencyConversion(b));
+ };
+
+ sort.DateConversion = function(val) {
+ // inner util function to parse date formats
+ function getdate(str) {
+ // inner util function to convert 2-digit years to 4
+ function fixYear(yr) {
+ yr = +yr;
+ if (yr<50) { yr += 2000; }
+ else if (yr<100) { yr += 1900; }
+ return yr;
+ };
+ var ret;
+ // YYYY-MM-DD
+ if (ret=str.match(/(\d{2,4})-(\d{1,2})-(\d{1,2})/)) {
+ return (fixYear(ret[1])*10000) + (ret[2]*100) + (+ret[3]);
+ }
+ // MM/DD/YY[YY] or MM-DD-YY[YY]
+ if (ret=str.match(/(\d{1,2})[\/-](\d{1,2})[\/-](\d{2,4})/)) {
+ return (fixYear(ret[3])*10000) + (ret[1]*100) + (+ret[2]);
+ }
+ return 99999999; // So non-parsed dates will be last, not first
+ };
+ return getdate(val);
+ };
+
+ sort.Date = function(a,b) {
+ return sort.Numeric(sort.DateConversion(a),sort.DateConversion(b));
+ };
+
+ return sort;
+})();
+
+var Position = (function() {
+ // Resolve a string identifier to an object
+ // ========================================
+ function resolveObject(s) {
+ if (document.getElementById && document.getElementById(s)!=null) {
+ return document.getElementById(s);
+ }
+ else if (document.all && document.all[s]!=null) {
+ return document.all[s];
+ }
+ else if (document.anchors && document.anchors.length && document.anchors.length>0 && document.anchors[0].x) {
+ for (var i=0; i<document.anchors.length; i++) {
+ if (document.anchors[i].name==s) {
+ return document.anchors[i]
+ }
+ }
+ }
+ }
+
+ var pos = {};
+ pos.$VERSION = 1.0;
+
+ // Set the position of an object
+ // =============================
+ pos.set = function(o,left,top) {
+ if (typeof(o)=="string") {
+ o = resolveObject(o);
+ }
+ if (o==null || !o.style) {
+ return false;
+ }
+
+ // If the second parameter is an object, it is assumed to be the result of getPosition()
+ if (typeof(left)=="object") {
+ var pos = left;
+ left = pos.left;
+ top = pos.top;
+ }
+
+ o.style.left = left + "px";
+ o.style.top = top + "px";
+ return true;
+ };
+
+ // Retrieve the position and size of an object
+ // ===========================================
+ pos.get = function(o) {
+ var fixBrowserQuirks = true;
+ // If a string is passed in instead of an object ref, resolve it
+ if (typeof(o)=="string") {
+ o = resolveObject(o);
+ }
+
+ if (o==null) {
+ return null;
+ }
+
+ var left = 0;
+ var top = 0;
+ var width = 0;
+ var height = 0;
+ var parentNode = null;
+ var offsetParent = null;
+
+
+ offsetParent = o.offsetParent;
+ var originalObject = o;
+ var el = o; // "el" will be nodes as we walk up, "o" will be saved for offsetParent references
+ while (el.parentNode!=null) {
+ el = el.parentNode;
+ if (el.offsetParent==null) {
+ }
+ else {
+ var considerScroll = true;
+ /*
+ In Opera, if parentNode of the first object is scrollable, then offsetLeft/offsetTop already
+ take its scroll position into account. If elements further up the chain are scrollable, their
+ scroll offsets still need to be added in. And for some reason, TR nodes have a scrolltop value
+ which must be ignored.
+ */
+ if (fixBrowserQuirks && window.opera) {
+ if (el==originalObject.parentNode || el.nodeName=="TR") {
+ considerScroll = false;
+ }
+ }
+ if (considerScroll) {
+ if (el.scrollTop && el.scrollTop>0) {
+ top -= el.scrollTop;
+ }
+ if (el.scrollLeft && el.scrollLeft>0) {
+ left -= el.scrollLeft;
+ }
+ }
+ }
+ // If this node is also the offsetParent, add on the offsets and reset to the new offsetParent
+ if (el == offsetParent) {
+ left += o.offsetLeft;
+ if (el.clientLeft && el.nodeName!="TABLE") {
+ left += el.clientLeft;
+ }
+ top += o.offsetTop;
+ if (el.clientTop && el.nodeName!="TABLE") {
+ top += el.clientTop;
+ }
+ o = el;
+ if (o.offsetParent==null) {
+ if (o.offsetLeft) {
+ left += o.offsetLeft;
+ }
+ if (o.offsetTop) {
+ top += o.offsetTop;
+ }
+ }
+ offsetParent = o.offsetParent;
+ }
+ }
+
+
+ if (originalObject.offsetWidth) {
+ width = originalObject.offsetWidth;
+ }
+ if (originalObject.offsetHeight) {
+ height = originalObject.offsetHeight;
+ }
+
+ return {'left':left, 'top':top, 'width':width, 'height':height
+ };
+ };
+
+ // Retrieve the position of an object's center point
+ // =================================================
+ pos.getCenter = function(o) {
+ var c = this.get(o);
+ if (c==null) { return null; }
+ c.left = c.left + (c.width/2);
+ c.top = c.top + (c.height/2);
+ return c;
+ };
+
+ return pos;
+})();// CLASS CONSTRUCTOR
+// --------------------------------------------------------------------
+var Popup = function(div, options) {
+ this.div = defined(div)?div:null;
+ this.index = Popup.maxIndex++;
+ this.ref = "Popup.objects["+this.index+"]";
+ Popup.objects[this.index] = this;
+ // Store a reference to the DIV by id, also
+ if (typeof(this.div)=="string") {
+ Popup.objectsById[this.div] = this;
+ }
+ if (defined(this.div) && this.div!=null && defined(this.div.id)) {
+ Popup.objectsById[this.div.id] = this.div.id;
+ }
+ // Apply passed-in options
+ if (defined(options) && options!=null && typeof(options)=="object") {
+ for (var i in options) {
+ this[i] = options[i];
+ }
+ }
+ return this;
+};
+
+// CLASS PROPERTIES
+// --------------------------------------------------------------------
+// Index of popup objects, to maintain a global reference if necessary
+Popup.maxIndex = 0;
+Popup.objects = {};
+Popup.objectsById = {};
+
+// The z-index value that popups will start at
+Popup.minZIndex = 101;
+
+// Class names to assign to other objects
+Popup.screenClass = "PopupScreen";
+Popup.iframeClass = "PopupIframe";
+Popup.screenIframeClass = "PopupScreenIframe";
+
+// CLASS METHODS
+// --------------------------------------------------------------------
+
+// Hide all currently-visible non-modal dialogs
+Popup.hideAll = function() {
+ for (var i in Popup.objects) {
+ var p = Popup.objects[i];
+ if (!p.modal && p.autoHide) {
+ p.hide();
+ }
+ }
+};
+// Catch global events as a trigger to hide auto-hide popups
+Event.add(document, "mouseup", Popup.hideAll, false);
+
+// A simple class method to show a popup without creating an instance
+Popup.show = function(divObject, referenceObject, position, options, modal) {
+ var popup;
+ if (defined(divObject)) {
+ popup = new Popup(divObject);
+ }
+ else {
+ popup = new Popup();
+ popup.destroyDivOnHide = true;
+ }
+ if (defined(referenceObject)) { popup.reference = DOM.resolve(referenceObject); }
+ if (defined(position)) { popup.position = position; }
+ if (defined(options) && options!=null && typeof(options)=="object") {
+ for (var i in options) {
+ popup[i] = options[i];
+ }
+ }
+ if (typeof(modal)=="boolean") {
+ popup.modal = modal;
+ }
+ popup.destroyObjectsOnHide = true;
+ popup.show();
+ return popup;
+};
+
+// A simple class method to show a modal popup
+Popup.showModal = function(divObject, referenceObject, position, options) {
+ Popup.show(divObject, referenceObject, position, options, true);
+};
+
+// A method to retrieve a popup object based on a div ID
+Popup.get = function(divId) {
+ if (defined(Popup.objectsById[divId])) {
+ return Popup.objectsById[divId];
+ }
+ return null;
+};
+
+// A method to hide a popup based on a div id
+Popup.hide = function(divId) {
+ var popup = Popup.get(divId);
+ if (popup!=null) {
+ popup.hide();
+ }
+};
+
+// PROTOTYPE PROPERTIES
+// --------------------------------------------------------------------
+Popup.prototype.content = null;
+Popup.prototype.className = "PopupDiv";
+Popup.prototype.style = null; // Styles to be applied to the DIV
+Popup.prototype.width = null;
+Popup.prototype.height = null;
+Popup.prototype.top = null;
+Popup.prototype.left = null;
+Popup.prototype.offsetLeft = 0;
+Popup.prototype.offsetTop = 0;
+Popup.prototype.constrainToScreen = true;
+Popup.prototype.autoHide = true;
+Popup.prototype.useIframeShim = false; /*@cc_on @*/ /*@if (@_win32) {Popup.prototype.useIframeShim = true;} @end @*/
+Popup.prototype.iframe = null;
+Popup.prototype.position = null; // vertical: "above top center bottom below", horizontal: "adjacent-left,left,center,right,adjacent-right"
+Popup.prototype.reference = null;
+Popup.prototype.modal = false;
+Popup.prototype.destroyDivOnHide = false;
+Popup.prototype.destroyObjectsOnHide = false;
+Popup.prototype.screen = null;
+Popup.prototype.screenIframeShim = null;
+Popup.prototype.screenOpacity=.4;
+Popup.prototype.screenColor="#cccccc";
+
+// INSTANCE METHODS
+// --------------------------------------------------------------------
+
+// Show the popup
+// --------------------------------------------------------------------
+Popup.prototype.show = function(options, modal) {
+ this.modal = this.modal || (typeof(modal)=="boolean" && modal);
+ if (defined(options) && options!=null && typeof(options)=="object") {
+ for (var i in options) {
+ this[i] = options[i];
+ }
+ }
+ this.div = DOM.resolve(this.div);
+ CSS.setStyle(this.div,'position','absolute');
+
+ // If there is no div pre-defined to use, create one
+ if (this.div==null) {
+ this.div = this.createDiv();
+ }
+ if (this.content!=null) {
+ this.div.innerHTML = this.content;
+ this.content = null;
+ }
+ if (this.className!=null) {
+ this.div.className = this.className;
+ }
+ if (this.style!=null) {
+ this.applyStyle();
+ }
+ if (this.width!=null) {
+ this.div.style.width = this.width+"px";
+ this.div.style.overflowX="auto";
+ }
+ if (this.height!=null) {
+ this.div.style.height = this.height+"px";
+ this.div.style.overflowY="auto";
+ }
+
+ // Do the actual display - this is a separate method so display transitions can be implemented
+ this.transition();
+
+ // Make sure clicks on the DIV don't bubble up to the document
+ this.div.onclick = function(e) {
+ Event.cancelBubble(Event.resolve(e));
+ };
+ this.div.onmouseup = this.div.onclick;
+
+ // Focus to the DIV if possible
+ if (this.modal && this.div.focus) {
+ this.div.focus();
+ }
+};
+
+// Show the popup but make it modal
+// --------------------------------------------------------------------
+Popup.prototype.transition = function() {
+ if (this.modal) {
+ this.addScreen();
+ }
+
+ // Make the DIV displayed but hidden so its size can be measured
+ CSS.setStyle(this.div,'visibility','hidden');
+ CSS.setStyle(this.div,'display','block');
+
+ // Position the popup
+ this.setPosition();
+
+ // Add the shim if necessary
+ if (this.useIframeShim) {
+ this.addIframeShim();
+ }
+
+ // Make sure the DIV is higher than the shim
+ this.div.style.zIndex = Popup.minZIndex++;
+
+ CSS.setStyle(this.div,'display','block');
+ CSS.setStyle(this.div,'visibility','visible');
+};
+
+// Show the popup but make it modal
+// --------------------------------------------------------------------
+Popup.prototype.showModal = function(options) {
+ this.show(options,true);
+};
+
+// Apply user styles to the DIV
+// --------------------------------------------------------------------
+Popup.prototype.applyStyle = function() {
+ if (this.div!=null && this.style!=null && typeof(this.style)=="object") {
+ for (var i in this.style) {
+ this.div.style[i] = this.style[i];
+ }
+ }
+};
+
+// Hide the popup
+// --------------------------------------------------------------------
+Popup.prototype.hide = function() {
+ // If this was a temp object creating on-the-fly, then remove objects from the DOM so
+ // The document doesn't get littered with extra objects
+ if (this.destroyDivOnHide) {
+ DOM.removeNode(this.div);
+ this.div = null;
+ delete Popup.objects[this.id];
+ }
+ else if (this.div!=null) {
+ CSS.setStyle(this.div,'display','none');
+ }
+
+ if (this.destroyObjectsOnHide) {
+ DOM.removeNode(this.iframe);
+ DOM.removeNode(this.screen);
+ DOM.removeNode(this.screenIframeShim);
+ }
+ else {
+ if (this.iframe!=null) {
+ this.iframe.style.display = "none";
+ }
+ if (this.screen!=null) {
+ this.screen.style.display = "none";
+ }
+ if (this.screenIframeShim!=null) {
+ this.screenIframeShim.style.display = "none";
+ }
+ }
+};
+
+// Util funcs for position
+// --------------------------------------------------------------------
+Popup.prototype.setTop = function(top) {
+ this.div.style.top = top+"px";
+};
+Popup.prototype.setLeft = function(left) {
+ this.div.style.left = left+"px";
+};
+Popup.prototype.getTop = function() {
+ return parseInt(CSS.getStyle(this.div,"top"),10);
+};
+Popup.prototype.getLeft = function() {
+ return parseInt(CSS.getStyle(this.div,"left"),10);
+};
+
+// All the logic to position the popup based on various criteria
+// --------------------------------------------------------------------
+Popup.prototype.setPosition = function() {
+ if (this.position!=null) {
+ var m = this.position.match(/^(\S+)\s+(\S+)/);
+ if (m!=null && m.length==3) {
+ var v = m[1];
+ var h = m[2];
+
+ var ref = this.reference;
+ if (ref==null) { ref = Screen.getBody(); }
+ var p = Position.get(ref);
+ var refTop = p.top;
+ var refLeft = p.left;
+ var refWidth = DOM.getOuterWidth(ref);
+ var refHeight = DOM.getOuterHeight(ref);
+
+ var width = DOM.getOuterWidth(this.div);
+ var height = DOM.getOuterHeight(this.div);
+
+ var scrollLeft = Screen.getScrollLeft();
+ var scrollTop = Screen.getScrollTop();
+
+ // Set vertical position relative to reference object
+ if (v=="above") { this.setTop(refTop-height+this.offsetTop); }
+ else if (v=="top") { this.setTop(refTop+this.offsetTop); }
+ else if (v=="center") { this.setTop(refTop+(refHeight/2)-(height/2)+this.offsetTop); }
+ else if (v=="bottom") { this.setTop(refTop+refHeight-height+this.offsetTop); }
+ else if (v=="below") { this.setTop(refTop+refHeight+this.offsetTop); }
+
+ // Set horizontal position relative to reference object
+ if (h=="adjacent-left") { this.setLeft(refLeft-width+this.offsetLeft); }
+ else if (h=="left") { this.setLeft(refLeft+this.offsetLeft); }
+ else if (h=="center") { this.setLeft(refLeft+(refWidth/2)-(width/2)+this.offsetLeft); }
+ else if (h=="right") { this.setLeft(refLeft+refWidth-width+this.offsetLeft); }
+ else if (h=="adjacent-right") { this.setLeft(refLeft+refWidth+this.offsetLeft); }
+ }
+ }
+ else if (this.top==null && this.left==null) {
+ this.center();
+ }
+ else {
+ if (this.top==null) { this.top=0; }
+ if (this.left==null) { this.left=0; }
+ this.div.style.top = this.top+this.offsetTop+"px";
+ this.div.style.left = this.left+this.offsetLeft+"px";
+ }
+
+ // Re-position to make sure it stays on the screen
+ if (this.constrainToScreen) {
+ this.fitToScreen();
+ }
+};
+
+// Append an object to the body
+// --------------------------------------------------------------------
+Popup.prototype.appendToBody = function(o) {
+ var body = Screen.getBody();
+ if (body && body.appendChild) {
+ body.appendChild(o);
+ }
+};
+
+// Create a new DIV object to be used for a popup
+// --------------------------------------------------------------------
+Popup.prototype.createDiv = function() {
+ if (document.createElement) {
+ var d = document.createElement("DIV");
+ d.style.position="absolute";
+ d.style.display="block";
+ d.style.visibility="hidden";
+ this.appendToBody(d);
+ return d;
+ }
+ alert("ERROR: Couldn't create DIV element in Popup.prototype.createDiv()");
+ return null;
+};
+
+// Create a new IFRAME object to be used behind the popup
+// --------------------------------------------------------------------
+Popup.prototype.createIframe = function() {
+ if (document.createElement) {
+ var i= document.createElement("IFRAME");
+ i.style.position="absolute";
+ i.style.display="block";
+ i.style.visibility="hidden";
+ i.style.background="none";
+ this.appendToBody(i);
+ return i;
+ }
+ else {
+ alert("ERROR: Couldn't create IFRAME object in Popup.prototype.createIframe()");
+ }
+};
+
+// Add an IFRAME shim for the DIV
+// --------------------------------------------------------------------
+Popup.prototype.addIframeShim = function() {
+ if (this.iframe==null) {
+ this.iframe = this.createIframe();
+ }
+ this.iframe.className = Popup.iframeClass;
+ CSS.setStyle(this.iframe,'top',this.getTop()+"px");
+ CSS.setStyle(this.iframe,'left',this.getLeft()+"px");
+ CSS.setStyle(this.iframe,'width',DOM.getOuterWidth(this.div) + "px");
+ CSS.setStyle(this.iframe,'height',DOM.getOuterHeight(this.div) + "px");
+ CSS.setStyle(this.iframe,'zIndex',Popup.minZIndex++);
+ CSS.setStyle(this.iframe,'opacity',0);
+ CSS.setStyle(this.iframe,'visibility','visible');
+ CSS.setStyle(this.iframe,'display','block');
+};
+
+// Create a "screen" to make a popup modal
+// --------------------------------------------------------------------
+Popup.prototype.addScreen = function() {
+ if (this.screen==null) {
+ this.screen = this.createDiv();
+ this.screen.style.top="0px";
+ this.screen.style.left="0px";
+ this.screen.style.backgroundColor = this.screenColor;
+ this.screen.className=Popup.screenClass;;
+ CSS.setStyle(this.screen,"opacity",this.screenOpacity);
+ this.screen.onclick = function(e) { Event.cancelBubble(Event.resolve(e)); }
+ }
+ if (this.screenIframeShim==null) {
+ this.screenIframeShim = this.createIframe();
+ this.screenIframeShim.style.top="0px";
+ this.screenIframeShim.style.left="0px";
+ this.screenIframeShim.className=Popup.screenIframeClass;
+ CSS.setStyle(this.screenIframeShim,"opacity",0);
+ }
+ this.screen.style.width = Screen.getDocumentWidth()+"px";
+ this.screen.style.height = Screen.getDocumentHeight()+"px";
+ this.screenIframeShim.style.width = Screen.getDocumentWidth()+"px";
+ this.screenIframeShim.style.height = Screen.getDocumentHeight()+"px";
+ this.screenIframeShim.style.zIndex = Popup.minZIndex++;
+ this.screenIframeShim.style.visibility="visible";
+ this.screenIframeShim.style.display="block";
+ this.screen.style.zIndex = Popup.minZIndex++;
+ this.screen.style.visibility="visible";
+ this.screen.style.display="block";
+};
+
+// Re-position the DIV so it stays on the screen
+// --------------------------------------------------------------------
+Popup.prototype.fitToScreen = function() {
+ var width = DOM.getOuterWidth(this.div);
+ var height = DOM.getOuterHeight(this.div);
+ var top = this.getTop();
+ var left = this.getLeft();
+
+ var clientWidth = Screen.getViewportWidth();
+ var clientHeight = Screen.getViewportHeight();
+
+ var scrollLeft = Screen.getScrollLeft();
+ var scrollTop = Screen.getScrollTop();
+
+ if (top-scrollTop+height>clientHeight) {
+ top = top - ((top+height) - (scrollTop+clientHeight));
+ this.div.style.top = top + "px";
+ }
+ if (left-scrollLeft+width>clientWidth) {
+ left = left - ((left+width) - (scrollLeft+clientWidth));
+ this.div.style.left = left + "px";
+ }
+ if (top<scrollTop) {
+ this.div.style.top=scrollTop+"px";
+ }
+ if (left<scrollLeft) {
+ this.div.style.left=scrollLeft+"px";
+ }
+};
+
+// Center the DIV object
+// --------------------------------------------------------------------
+Popup.prototype.center = function() {
+ var left = DOM.getOuterWidth(this.div);
+ var top = DOM.getOuterHeight(this.div);
+ if (isNaN(left)) { left=0; }
+ if (isNaN(top)) { top=0; }
+ var clientW = Screen.getViewportWidth();
+ var clientH = Screen.getViewportHeight();
+ if (clientW!=null && clientH!=null) {
+ top = (clientH-top)/2;
+ left = (clientW-left)/2;
+ }
+ top += Screen.getScrollTop();
+ left += Screen.getScrollLeft();
+
+ this.div.style.top = top+this.offsetTop+"px";
+ this.div.style.left = left+this.offsetLeft+"px";
+};
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="html" version="1.0" encoding="UTF-8"
+ indent="yes" />
+ <xsl:template match="/">
+ <html>
+ <STYLE type="text/css">
+ @import "./style/tests.css";
+ </STYLE>
+ <head>
+ <script type="text/javascript" src="./style/jquery.min.js" />
+ </head>
+ <body>
+ <div id="testcasepage">
+ <div id="title">
+ <table>
+ <tr>
+ <td>
+ <h1>TCT Report</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="overview">
+ <table>
+ <tr>
+ <td>
+ <div id="summary">
+ <table>
+ <tr>
+ <th colspan="2">Test Summary</th>
+ </tr>
+ <!-- tr>
+ <td>TCT Version</td>
+ <td>
+ <xsl:value-of select="result_summary/environment/@cts_version" />
+ </td>
+ </tr -->
+ <tr>
+ <td>Test Plan Name</td>
+ <td>
+ <xsl:value-of select="result_summary/@plan_name" />
+ </td>
+ </tr>
+ <tr>
+ <td>Build ID</td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="result_summary/environment/@build_id">
+ <xsl:if test="result_summary/environment/@build_id = ''">
+ N/A
+ </xsl:if>
+ <xsl:value-of select="result_summary/environment/@build_id" />
+ </xsl:when>
+ <xsl:otherwise>
+ N/A
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td>Test Total</td>
+ <td>
+ <xsl:value-of select="sum(result_summary//suite/total_case)" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Passed</td>
+ <td>
+ <xsl:value-of select="sum(result_summary//suite/pass_case)" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Failed</td>
+ <td>
+ <xsl:value-of select="sum(result_summary//suite/fail_case)" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Blocked</td>
+ <td>
+ <xsl:value-of select="sum(result_summary//suite/block_case)" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Not Executed</td>
+ <td>
+ <xsl:value-of select="sum(result_summary//suite/na_case)" />
+ </td>
+ </tr>
+ <tr>
+ <td>Time</td>
+ <td>
+ <xsl:value-of select="result_summary/summary/start_at" />
+ ~
+ <xsl:value-of select="result_summary/summary/end_at" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ <td>
+ <div id="device">
+ <table>
+ <tr>
+ <th colspan="2">Device Information</th>
+ </tr>
+ <tr>
+ <td>Host Device</td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="result_summary/environment/@host">
+ <xsl:if test="result_summary/environment/@host = ''">
+ N/A
+ </xsl:if>
+ <xsl:value-of select="result_summary/environment/@host" />
+ </xsl:when>
+ <xsl:otherwise>
+ N/A
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td>Manufacturer</td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="result_summary/environment/@manufacturer">
+ <xsl:if test="result_summary/environment/@manufacturer = ''">
+ N/A
+ </xsl:if>
+ <xsl:value-of select="result_summary/environment/@manufacturer" />
+ </xsl:when>
+ <xsl:otherwise>
+ N/A
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td>Device Model</td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="result_summary/environment/@device_model">
+ <xsl:if test="result_summary/environment/@device_model = ''">
+ N/A
+ </xsl:if>
+ <xsl:value-of select="result_summary/environment/@device_model" />
+ </xsl:when>
+ <xsl:otherwise>
+ N/A
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td>Device ID</td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="result_summary/environment/@device_id">
+ <xsl:if test="result_summary/environment/@device_id = ''">
+ N/A
+ </xsl:if>
+ <xsl:value-of select="result_summary/environment/@device_id" />
+ </xsl:when>
+ <xsl:otherwise>
+ N/A
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td>Screen Size</td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="result_summary/environment/@screen_size">
+ <xsl:if test="result_summary/environment/@screen_size = ''">
+ N/A
+ </xsl:if>
+ <xsl:value-of select="result_summary/environment/@screen_size" />
+ </xsl:when>
+ <xsl:otherwise>
+ N/A
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td>Resolution</td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="result_summary/environment/@resolution">
+ <xsl:if test="result_summary/environment/@resolution = ''">
+ N/A
+ </xsl:if>
+ <xsl:value-of select="result_summary/environment/@resolution" />
+ </xsl:when>
+ <xsl:otherwise>
+ N/A
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="capability">
+ <div id="title">
+ <a name="contents"></a>
+ <table>
+ <tr>
+ <td class="title">
+ <h1><a href="#" class="see_capabilities">Device Capability</a></h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <xsl:choose>
+ <xsl:when test="result_summary/capabilities">
+ <div id="capability_table" style="display:none;">
+ <table>
+ <tr>
+ <th>Capability Name</th>
+ <th>Type</th>
+ <th>Value</th>
+ </tr>
+ <xsl:for-each select="result_summary/capabilities/capability">
+ <xsl:sort select="@name" />
+ <tr>
+ <td>
+ <xsl:value-of select="@name" />
+ </td>
+ <td>
+ <xsl:value-of select="@type" />
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="value">
+ <xsl:value-of select="value" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@support" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ The information of device capability is not available.
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+
+ <div id="suite_summary">
+ <div id="title">
+ <a name="contents"></a>
+ <table>
+ <tr>
+ <td class="title">
+ <h1>Test Summary by Suite</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <table>
+ <tr>
+ <th>Suite</th>
+ <th>Total</th>
+ <th>Passed</th>
+ <th>Failed</th>
+ <th>Blocked</th>
+ <th>Not Executed</th>
+ <th class="Ratio">Ratio</th>
+ </tr>
+ <xsl:for-each select="result_summary/suite">
+ <xsl:sort select="@name" />
+ <tr class="suite_item">
+ <xsl:attribute name="id">
+ <xsl:value-of
+ select="@name" />
+ </xsl:attribute>
+ <td>
+ <a>
+ <xsl:attribute name="href"><xsl:value-of
+ select="@name" />.xml</xsl:attribute>
+ <xsl:value-of select="@name" />
+ </a>
+ </td>
+ <td class="total">
+ <xsl:value-of select="total_case" />
+ </td>
+ <td class="pass">
+ <xsl:value-of select="pass_case" />
+ </td>
+ <td class="fail">
+ <xsl:value-of select="fail_case" />
+ </td>
+ <td class="block">
+ <xsl:value-of select="block_case" />
+ </td>
+ <td class="na">
+ <xsl:value-of select="na_case" />
+ </td>
+ <td class="Ratio">
+ <div class="RatioGraphic" />
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </div>
+
+ </div>
+ <div id="goTopBtn">
+ <img border="0" src="./style/back_top.png" />
+ </div>
+ <script type="text/javascript" src="./style/application.js" />
+ <script language="javascript" type="text/javascript">
+ $(document).ready(function(){
+ goTopEx();
+ drawRatio();
+ });
+ </script>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template name="br-replace">
+ <xsl:param name="word" />
+ <xsl:variable name="cr">
+ <xsl:text>\n</xsl:text>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($word,$cr)">
+ <xsl:value-of select="substring-before($word,$cr)" />
+ <br />
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word" select="substring-after($word,$cr)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$word" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="html" version="1.0" encoding="UTF-8"
+ indent="yes" />
+ <xsl:template match="/">
+ <html>
+ <STYLE type="text/css">
+ @import "./style/tests.css";
+ </STYLE>
+ <head>
+ <script type="text/javascript" src="./style/jquery.min.js" />
+ <script type="text/javascript" src="./style/popup.js" />
+ </head>
+ <body>
+ <div id="title">
+ <table>
+ <tr>
+ <td class="title">
+ <h1 align="center">Suite Test Results</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="btc">
+ <table>
+ <tr>
+ <td>
+ <a href="#" class="see_all">Show all</a>
+ </td>
+ <td>
+ <a href="#" class="see_failed">Show only failed</a>
+ </td>
+ <td>
+ <a href="#" class="see_blocked">Show only blocked</a>
+ </td>
+ <td>
+ <a href="#" class="see_na">Show only not executed</a>
+ </td>
+ <td>
+ <a href="summary.xml">Summary</a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="testcasepage">
+ <div id="cases">
+ <div id="see_all">
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <div id="suite_title">
+ <h2>
+ Test Suite:
+ <xsl:value-of select="@name" />
+ (All)
+ </h2>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:value-of
+ select="@name" />
+ </xsl:attribute>
+ </a>
+ </div>
+ <table>
+ <tr>
+ <th>Case_ID</th>
+ <th>Purpose</th>
+ <th>Result</th>
+ <th>Stderr</th>
+ </tr>
+ <xsl:for-each select=".//set">
+ <xsl:sort select="@name" />
+ <tr>
+ <xsl:choose>
+ <xsl:when test="@name">
+ <td colspan="3">
+ <h3>
+ Test Set:
+ <xsl:value-of select="@name" />
+ </h3>
+ </td>
+ <td colspan="1">
+ <h4>
+ <a>
+ <xsl:attribute name="href"><xsl:value-of
+ select="@set_debug_msg" /></xsl:attribute>
+ dlog
+ </a>
+ </h4>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td colspan="4">
+ <h3>
+ Test Set:
+ <xsl:value-of select="@name" />
+ </h3>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ <xsl:for-each select=".//testcase">
+ <xsl:sort select="@id" />
+ <tr>
+ <td>
+ <div
+ style="background-color:#F5DEB3;border:1px solid black;display:none;">
+ <xsl:attribute name="id"><xsl:value-of
+ select="@id" /></xsl:attribute>
+ <p>
+ <xsl:for-each select="./description/steps//step">
+ <xsl:sort select="@order" />
+ <B>
+ Step
+ <xsl:value-of select="@order" />
+ :
+ </B>
+ <br />
+ <xsl:value-of select=".//step_desc" />
+ <br />
+ <B>Expected:</B>
+ <xsl:value-of select=".//expected" />
+ <br />
+ </xsl:for-each>
+ </p>
+ <p>
+ <br />
+ <B>
+ Entry:
+ <br />
+ </B>
+ <xsl:value-of select="./description//test_script_entry" />
+ <br />
+ </p>
+ </div>
+ <a href="#" class="test_case_popup">
+ <xsl:attribute name="id"><xsl:value-of
+ select="@id" /></xsl:attribute>
+ <xsl:value-of select="@id" />
+ </a>
+ </td>
+ <td>
+ <xsl:value-of select="@purpose" />
+ </td>
+
+ <xsl:choose>
+ <xsl:when test="@result">
+ <xsl:if test="@result = 'FAIL'">
+ <td class="red_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ </xsl:if>
+ <xsl:if test="@result = 'PASS'">
+ <td class="green_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ </xsl:if>
+ <xsl:if test="@result = 'BLOCK' ">
+ <td class="orange_rate">
+ BLOCK
+ </td>
+ </xsl:if>
+ <xsl:if
+ test="@result != 'BLOCK' and @result != 'FAIL' and @result != 'PASS' ">
+ <td class="gray_rate">
+ Not Run
+ </td>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>
+
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td>
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word"
+ select=".//result_info/stderr" />
+ </xsl:call-template>
+ <xsl:if test=".//result_info/stderr = ''">
+ N/A
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </div>
+ <div id="see_fail" style="display:none;">
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <div id="suite_title">
+ <h2>
+ Test Suite:
+ <xsl:value-of select="@name" />
+ (Failed only)
+ </h2>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:value-of
+ select="@name" />
+ </xsl:attribute>
+ </a>
+ </div>
+ <table>
+ <tr>
+ <th>Case_ID</th>
+ <th>Purpose</th>
+ <th>Result</th>
+ <th>Stderr</th>
+ </tr>
+ <xsl:for-each select=".//set">
+ <xsl:sort select="@name" />
+ <tr>
+ <xsl:choose>
+ <xsl:when test="@name">
+ <td colspan="3">
+ <h3>
+ Test Set:
+ <xsl:value-of select="@name" />
+ </h3>
+ </td>
+ <td colspan="1">
+ <h4>
+ <a>
+ <xsl:attribute name="href"><xsl:value-of
+ select="@set_debug_msg" /></xsl:attribute>
+ dlog
+ </a>
+ </h4>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td colspan="4">
+ <h3>
+ Test Set:
+ <xsl:value-of select="@name" />
+ </h3>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ <xsl:for-each select=".//testcase[@result='FAIL']">
+ <xsl:sort select="@id" />
+ <tr>
+ <td>
+ <div
+ style="background-color:#F5DEB3;border:1px solid black;display:none;">
+ <xsl:attribute name="id">fail_<xsl:value-of
+ select="@id" /></xsl:attribute>
+ <p>
+ <xsl:for-each select="./description/steps//step">
+ <xsl:sort select="@order" />
+ <B>
+ Step
+ <xsl:value-of select="@order" />
+ :
+ </B>
+ <br />
+ <xsl:value-of select=".//step_desc" />
+ <br />
+ <B>Expected:</B>
+ <xsl:value-of select=".//expected" />
+ <br />
+ </xsl:for-each>
+ </p>
+ <p>
+ <br />
+ <B>
+ Entry:
+ <br />
+ </B>
+ <xsl:value-of select="./description//test_script_entry" />
+ <br />
+ </p>
+ </div>
+ <a href="#" class="test_case_popup">
+ <xsl:attribute name="id">fail_<xsl:value-of
+ select="@id" /></xsl:attribute>
+ <xsl:value-of select="@id" />
+ </a>
+ </td>
+ <td>
+ <xsl:value-of select="@purpose" />
+ </td>
+
+ <td class="red_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ <td>
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word"
+ select=".//result_info/stderr" />
+ </xsl:call-template>
+ <xsl:if test=".//result_info/stderr = ''">
+ N/A
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </div>
+ <div id="see_block" style="display:none;">
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <div id="suite_title">
+ <h2>
+ Test Suite:
+ <xsl:value-of select="@name" />
+ (Blocked Only)
+ </h2>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:value-of
+ select="@name" />
+ </xsl:attribute>
+ </a>
+ </div>
+ <table>
+ <tr>
+ <th>Case_ID</th>
+ <th>Purpose</th>
+ <th>Result</th>
+ <th>Stderr</th>
+ </tr>
+ <xsl:for-each select=".//set">
+ <xsl:sort select="@name" />
+ <tr>
+ <xsl:choose>
+ <xsl:when test="@name">
+ <td colspan="3">
+ <h3>
+ Test Set:
+ <xsl:value-of select="@name" />
+ </h3>
+ </td>
+ <td colspan="1">
+ <h4>
+ <a>
+ <xsl:attribute name="href"><xsl:value-of
+ select="@set_debug_msg" /></xsl:attribute>
+ dlog
+ </a>
+ </h4>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td colspan="4">
+ <h3>
+ Test Set:
+ <xsl:value-of select="@name" />
+ </h3>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ <xsl:for-each select=".//testcase[@result='BLOCK']">
+ <xsl:sort select="@id" />
+ <tr>
+ <td>
+ <div
+ style="background-color:#F5DEB3;border:1px solid black;display:none;">
+ <xsl:attribute name="id">block_<xsl:value-of
+ select="@id" /></xsl:attribute>
+ <p>
+ <xsl:for-each select="./description/steps//step">
+ <xsl:sort select="@order" />
+ <B>
+ Step
+ <xsl:value-of select="@order" />
+ :
+ </B>
+ <br />
+ <xsl:value-of select=".//step_desc" />
+ <br />
+ <B>Expected:</B>
+ <xsl:value-of select=".//expected" />
+ <br />
+ </xsl:for-each>
+ </p>
+ <p>
+ <br />
+ <B>
+ Entry:
+ <br />
+ </B>
+ <xsl:value-of select="./description//test_script_entry" />
+ <br />
+ </p>
+ </div>
+ <a href="#" class="test_case_popup">
+ <xsl:attribute name="id">block_<xsl:value-of
+ select="@id" /></xsl:attribute>
+ <xsl:value-of select="@id" />
+ </a>
+ </td>
+ <td>
+ <xsl:value-of select="@purpose" />
+ </td>
+
+ <td class="orange_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ <td>
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word"
+ select=".//result_info/stderr" />
+ </xsl:call-template>
+ <xsl:if test=".//result_info/stderr = ''">
+ N/A
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </div>
+ <div id="see_na" style="display:none;">
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <div id="suite_title">
+ <h2>
+ Test Suite:
+ <xsl:value-of select="@name" />
+ (Not executed Only)
+ </h2>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:value-of
+ select="@name" />
+ </xsl:attribute>
+ </a>
+ </div>
+ <table>
+ <tr>
+ <th>Case_ID</th>
+ <th>Purpose</th>
+ <th>Result</th>
+ <th>Stderr</th>
+ </tr>
+ <xsl:for-each select=".//set">
+ <xsl:sort select="@name" />
+ <tr>
+ <xsl:choose>
+ <xsl:when test="@name">
+ <td colspan="3">
+ <h3>
+ Test Set:
+ <xsl:value-of select="@name" />
+ </h3>
+ </td>
+ <td colspan="1">
+ <h4>
+ <a>
+ <xsl:attribute name="href"><xsl:value-of
+ select="@set_debug_msg" /></xsl:attribute>
+ dlog
+ </a>
+ </h4>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td colspan="4">
+ <h3>
+ Test Set:
+ <xsl:value-of select="@name" />
+ </h3>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ <xsl:for-each select=".//testcase[@result='N/A']">
+ <xsl:sort select="@id" />
+ <tr>
+ <td>
+ <div
+ style="background-color:#F5DEB3;border:1px solid black;display:none;">
+ <xsl:attribute name="id">na_<xsl:value-of
+ select="@id" /></xsl:attribute>
+ <p>
+ <xsl:for-each select="./description/steps//step">
+ <xsl:sort select="@order" />
+ <B>
+ Step
+ <xsl:value-of select="@order" />
+ :
+ </B>
+ <br />
+ <xsl:value-of select=".//step_desc" />
+ <br />
+ <B>Expected:</B>
+ <xsl:value-of select=".//expected" />
+ <br />
+ </xsl:for-each>
+ </p>
+ <p>
+ <br />
+ <B>
+ Entry:
+ <br />
+ </B>
+ <xsl:value-of select="./description//test_script_entry" />
+ <br />
+ </p>
+ </div>
+ <a href="#" class="test_case_popup">
+ <xsl:attribute name="id">na_<xsl:value-of
+ select="@id" /></xsl:attribute>
+ <xsl:value-of select="@id" />
+ </a>
+ </td>
+ <td>
+ <xsl:value-of select="@purpose" />
+ </td>
+
+ <td class="gray_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ <td>
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word"
+ select=".//result_info/stderr" />
+ </xsl:call-template>
+ <xsl:if test=".//result_info/stderr = ''">
+ N/A
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </div>
+ </div>
+ </div>
+ <div id="goTopBtn">
+ <img border="0" src="./style/back_top.png" />
+ </div>
+ <script type="text/javascript" src="./style/application.js" />
+ <script language="javascript" type="text/javascript">
+ $(document).ready(function(){
+ goTopEx();
+ });
+ </script>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template name="br-replace">
+ <xsl:param name="word" />
+ <xsl:variable name="cr">
+ <xsl:text>\n</xsl:text>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($word,$cr)">
+ <xsl:value-of select="substring-before($word,$cr)" />
+ <br />
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word" select="substring-after($word,$cr)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$word" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
--- /dev/null
+@charset "UTF-8";\r
+/* CSS Document */\r
+#testcasepage div,#testcasepage h1,#testcasepage p,#testcasepage table,#testcasepage tr,#testcasepage th,#testcasepage td\r
+ {\r
+ margin: 0;\r
+ padding: 0;\r
+ border: 0;\r
+ font-weight: inherit;\r
+ font-style: inherit;\r
+ font-size: 0.96em;\r
+ font-family: arial;\r
+ vertical-align: baseline;\r
+}\r
+\r
+#title td, #btc td{\r
+ margin: 0;\r
+ padding: 0;\r
+ border: 0;\r
+ font-weight: inherit;\r
+ font-style: inherit;\r
+ font-size: 0.96em;\r
+ font-family: arial;\r
+ vertical-align: baseline;\r
+}\r
+\r
+td.Ratio {\r
+ text-align: left;\r
+ font-weight: normal;\r
+ padding: 4px 10px 4px 5px;\r
+ vertical-align: middle;\r
+}\r
+\r
+th.Ratio {\r
+ width: 400px;\r
+}\r
+\r
+#testcasepage p {\r
+ text-align: left;\r
+}\r
+\r
+#suite_title {\r
+ text-align: left;\r
+}\r
+\r
+#btc {\r
+ text-align: right;\r
+}\r
+\r
+#btc table {\r
+ position: absolute;\r
+ right: 0px;\r
+ width: 600px;\r
+}\r
+\r
+#testcasepage table {\r
+ border-collapse: separate;\r
+ border-spacing: 0;\r
+ margin-bottom: 1.4em;\r
+ vertical-align: middle;\r
+}\r
+\r
+#testcasepage th,#testcasepage td {\r
+ text-align: left;\r
+ font-weight: normal;\r
+ padding: 4px 10px 4px 5px;\r
+ vertical-align: middle;\r
+}\r
+\r
+#cases table {\r
+ width: 101%;\r
+}\r
+\r
+#cases td {\r
+ border-left: 0px;\r
+ font-weight: normal;\r
+ border-bottom: 0px;\r
+}\r
+\r
+#suite_summary table {\r
+ width: 100%;\r
+}\r
+\r
+\r
+#overview table {\r
+ width: 101%;\r
+}\r
+\r
+#overview table, #overview td, #overview tr {\r
+ border-left: none;\r
+ border-bottom: none;\r
+ border-right: none;\r
+ vertical-align: top;\r
+}\r
+\r
+#overview td{\r
+ width: 50%;\r
+}\r
+\r
+#capability table {\r
+ width: 50%;\r
+}\r
+\r
+#fail_cases table {\r
+ width: 101%;\r
+}\r
+\r
+#title table {\r
+ width: 101%;\r
+}\r
+\r
+#device table {\r
+ width: 100%;\r
+}\r
+\r
+#summary table {\r
+ width: 100%;\r
+}\r
+\r
+#testcasepage th {\r
+ border-bottom: 1px solid #000;\r
+ background-color: #AAAAAA;\r
+ border-left: 1px solid #000;\r
+ border-top: 1px solid #000;\r
+ color: #000;\r
+ font-weight: bold;\r
+ vertical-align: bottom;\r
+}\r
+\r
+#summary th:last-child,#summary td:last-child, #device th:last-child,#device td:last-child, #suite_summary th:last-child,#suite_summary td:last-child,#cases th:last-child,#cases td:last-child,#capability th:last-child,#capability td:last-child {\r
+ border-right: 1px solid #000;\r
+}\r
+\r
+#testcasepage td {\r
+ font-weight: normal;\r
+}\r
+\r
+#summary td, #device td, #capability td, #suite_summary td, #cases td{\r
+ border-left: 1px solid;\r
+ font-weight: normal;\r
+ border-bottom: 1px solid;\r
+}\r
+\r
+#testcasepage td.yellow_rate {\r
+ background-color: #ffcc00;\r
+}\r
+\r
+#testcasepage td.green_rate {\r
+ background-color: #1E90FF;\r
+}\r
+\r
+#testcasepage td.dgreen_rate {\r
+ background-color: #339933;\r
+}\r
+\r
+#testcasepage td.red_rate {\r
+ background-color: #FF3333;\r
+}\r
+\r
+#testcasepage td.orange_rate {\r
+ background-color: #FFA500;\r
+}\r
+\r
+#testcasepage td.gray_rate {\r
+ background-color: #AAAAAA;\r
+}\r
+\r
+#title table,#title tr,#title td {\r
+ border-left: none;\r
+ border-bottom: none;\r
+ text-align: center;\r
+}\r
+\r
+#title td:last-child {\r
+ border-right: none;\r
+}\r
+\r
+#testcasepage h1 {\r
+ font-size: 2em;\r
+ font-family: Arial, sans-serif;\r
+ font-weight: bold;\r
+ line-height: 1;\r
+ color: #000;\r
+ margin-bottom: 0.75em;\r
+ padding-top: 0.25em;\r
+ font-weight: bold;\r
+}\r
+\r
+#goTopBtn {\r
+ right: 0px;\r
+ bottom: 0px;\r
+ position: fixed; +\r
+ position: absolute;\r
+ top: expression(parseInt(document.body.scrollTop)+document.body.clientHeight-40\r
+ );\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="./style/summary.xsl"?>
+<result_summary plan_name="Core">
+ <other xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" />
+ <summary test_plan_name="Empty test_plan_name">
+ <start_at>2014-03-21_18_52_41</start_at>
+ <end_at>2014-03-21_18_57_54</end_at>
+ </summary>
+ <suite name="tct-dali-toolkit-core-tests">
+ <total_case>231</total_case>
+ <pass_case>222</pass_case>
+ <pass_rate>96.10</pass_rate>
+ <fail_case>9</fail_case>
+ <fail_rate> 3.90</fail_rate>
+ <block_case>0</block_case>
+ <block_rate>0.00</block_rate>
+ <na_case>0</na_case>
+ <na_rate>0.00</na_rate>
+ </suite>
+ <suite name="tct-dali-toolkit-internal-core-tests">
+ <total_case>33</total_case>
+ <pass_case>31</pass_case>
+ <pass_rate>93.94</pass_rate>
+ <fail_case>2</fail_case>
+ <fail_rate> 6.06</fail_rate>
+ <block_case>0</block_case>
+ <block_rate>0.00</block_rate>
+ <na_case>0</na_case>
+ <na_rate>0.00</na_rate>
+ </suite>
+ <suite name="tct-dali-toolkit-unmanaged-core-tests">
+ <total_case>311</total_case>
+ <pass_case>290</pass_case>
+ <pass_rate>93.25</pass_rate>
+ <fail_case>21</fail_case>
+ <fail_rate> 6.75</fail_rate>
+ <block_case>0</block_case>
+ <block_rate>0.00</block_rate>
+ <na_case>0</na_case>
+ <na_rate>0.00</na_rate>
+ </suite>
+</result_summary>
+++ /dev/null
-#!/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 <<EOH;
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
-"http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
-<head>
-<title>TETware Test Run Report</title>
-</head>
-<body bgcolor="white">
-<p><table border="1" width="100%" cellpadding="3" cellspacing="0">
-<tr><td bgcolor="#ccccff" class="heading1"><center><h1>
-TETware Test Run Report</h1></center></td></tr></table></p>
-<p><table border="0" cellpadding="2" cellspacing="1">
-<tr>
-<td align="left" class="noborder">Date of test run:</td>
-<td align="left" class="noborder">$date</td>
-</tr>
-<tr>
-<td align="left" class="noborder">Start time:</td>
-<td align="left" class="noborder">$time</td>
-</tr>
-</table></p>
-<hr>
-EOH
-}
-
-sub summary
-{
- my $heading = shift;
- my $summary_ref = shift;
-
- print <<EOS1;
- <p><table border="1" cellpadding="3" cellspacing="0">
- <tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b>$heading</b></font></td></tr>
- </table></p>
- <p><table border="0" cellpadding="5" cellspacing="4">
- <tr>
- <td align="center" bgcolor="#cccccc" class="neutral"><b>Result</b></td>
- <td align="center" bgcolor="#cccccc" class="neutral"><b>Count</b></td>
- </tr>
-EOS1
-
- my ($success_string, @blah) = grep(/(Success|PASS)/, keys(%$summary_ref));
- my $successes = $summary_ref->{$success_string};
- print <<EOS2;
- <tr>
- <td align="left" bgcolor="#33cc33" class="success">$success_string</td>
- <td align="right" bgcolor="#33cc33" class="success">$successes</td>
- </tr>
-EOS2
-
- foreach my $key (sort(grep(!/(Success|PASS|Total)/, keys(%$summary_ref))))
- {
- my $fails = $summary_ref->{$key};
- print <<EOS3;
- <tr>
- <td align="left" bgcolor="#ff5555" class="failure">$key</td>
- <td align="right" bgcolor="#ff5555" class="failure">$fails</td>
- </tr>
-EOS3
- }
-
- my $total = $summary_ref->{"Total"};
- print <<EOS4;
- <tr>
- <td align="left" bgcolor="#cccccc" class="neutral"><b>Total</b></td>
- <td align="right" bgcolor="#cccccc" class="neutral"><b>$total</b></td>
- </tr>
- </table></p>
-EOS4
-}
-
-
-sub build_breakdown
-{
- print <<EOB;
-<hr>
-<p><table border="1" cellpadding="3" cellspacing="0">
-<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b>
-Build mode result breakdown</b></font></td></tr></table></p>
-<p><table border="0" cellpadding="5" cellspacing="4">
-<tr>
-<td align="center" bgcolor="#cccccc" class="neutral"><b>Testcase</b></td>
-<td align="center" bgcolor="#cccccc" class="neutral"><b>Result</b></td>
-</tr>
-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("<tr><td align=\"left\" bgcolor=\"$color\" class=\"$class\">$key</td>\n");
- print("<td align=\"left\" bgcolor=\"$color\" class=\"$class\">$Class</td>\n");
- }
- print("</table><p>");
-}
-
-
-sub execute_breakdown
-{
- print <<EOE;
-<hr>
-<p><table border="1" cellpadding="3" cellspacing="0">
-<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b>
-Execute mode result breakdown</b></font></td></tr></table></p>
-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 "<h3>$result</h3>\n";
- print <<EOE2;
- <p><table border="0" cellpadding="5" cellspacing="4">
- <tr>
- <td align="center" bgcolor="#cccccc" class="neutral"><b>Testcase</b></td>
- <td align="center" bgcolor="#cccccc" class="neutral"><b>Test purposes (IC.TP)</b></td>
- </tr>
-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;
- <tr>
- <td align="left" bgcolor=$bgcolor class=$result>$testcase</td>
- <td align="left" bgcolor=$bgcolor class=$result>$tests</td>
- </tr>
-EOE3
- }
- print "</table>";
- }
-}
-
-
-sub footer
-{
- print "<hr>\n</body>\n</html>\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";
--- /dev/null
+scripts/tcbuild.sh
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+ <?xml-stylesheet type="text/xsl" href="./testcase.xsl"?>
+<test_definition>
+ <suite name="tct-dali-toolkit-unmanaged-core-tests" category="Core APIs">
+ <set name="default">
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumLayoutNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumLayoutNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetAndGetItemSizeFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetAndGetItemSizeFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetAndGetScrollSpeedFactor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetAndGetScrollSpeedFactor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetAndGetMaximumSwipeSpeed" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetAndGetMaximumSwipeSpeed</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetNumOfItems" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetNumOfItems</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetStackNum" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetStackNum</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetPosition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetPosition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetRotationX" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetRotationX</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetRotationZ" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetRotationZ</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetScale" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetScale</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetColor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetColor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetCenterPosition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetCenterPosition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetSetCenterScale" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetSetCenterScale</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetSetCenterColor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetSetCenterColor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetStackPosition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetStackPosition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetSetStackScale" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetSetStackScale</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliAlbumSetStackColor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliAlbumSetStackColor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBendyUninitializedEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBendyUninitializedEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBendyPropertyNamesEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBendyPropertyNamesEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBendyDefaultValuesEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBendyDefaultValuesEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBendyCustomValuesEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBendyCustomValuesEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBlindEffectUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBlindEffectUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBlindEffectPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBlindEffectPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBlindEffectDefaultValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBlindEffectDefaultValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBlindEffectCustomValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBlindEffectCustomValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBloomViewUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBloomViewNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBloomViewDownCast" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewDownCast</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBloomViewPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBloomViewAddRemove" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomViewAddRemove</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBloomActivateDeactivate" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBloomActivateDeactivate</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBuilderTextActorCreateFromStyle" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderTextActorCreateFromStyle</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBuilderTextActorCreateAnimation" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderTextActorCreateAnimation</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBuilderTextActorApplyFromStyle" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderTextActorApplyFromStyle</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBuilderAddActors" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderAddActors</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBuilderAddActorsOther" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderAddActorsOther</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBuilderStyles" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderStyles</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliBuilderSetProperty" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliBuilderSetProperty</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCarouselEffectUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCarouselEffectUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCarouselEffectPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCarouselEffectPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCarouselEffectDefaultValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCarouselEffectDefaultValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCarouselEffectCustomValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCarouselEffectCustomValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCheckBoxButtonSetGetChecked" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCheckBoxButtonSetGetChecked</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCheckBoxButtonSetImages" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCheckBoxButtonSetImages</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliClusterNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliClusterDownCast" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterDownCast</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliClusterAddAndRemoveChild" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterAddAndRemoveChild</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliClusterExpandAndCollapseChild" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterExpandAndCollapseChild</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliClusterSetAndGetStyle" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliClusterSetAndGetStyle</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionWaveEffectNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionWaveEffectNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionCrossEffectNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionCrossEffectNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionFoldEffectNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionFoldEffectNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionEffectSetGetTransitionDuration" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSetGetTransitionDuration</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionEffectSetGetCubeDisplacement" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSetGetCubeDisplacement</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionEffectGetRoot" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectGetRoot</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionEffectIsTransiting" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectIsTransiting</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionEffectSetCurrentImage" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSetCurrentImage</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionEffectSetTargetImage" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSetTargetImage</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionWaveEffectStartTransition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionWaveEffectStartTransition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionCrossEffectStartTransition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionCrossEffectStartTransition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionFoldEffectStartTransition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionFoldEffectStartTransition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionEffectSignalTransitionCompleted" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectSignalTransitionCompleted</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionEffectPauseResumeTransition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionEffectPauseResumeTransition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionWaveEffectStopTransition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionWaveEffectStopTransition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionCrossEffectStopTransition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionCrossEffectStopTransition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliCubeTransitionFoldEffectStopTransition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliCubeTransitionFoldEffectStopTransition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetNumberOfColumns" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetNumberOfColumns</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetNumberOfRows" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetNumberOfRows</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetRowSpacing" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetRowSpacing</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetTiltAngle" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetTiltAngle</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetItemSizeFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetItemSizeFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetBottomMarginFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetBottomMarginFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetItemTiltAngle" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetItemTiltAngle</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetColumnPositionFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetColumnPositionFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetScrollSpeedFactor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetScrollSpeedFactor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutConstraintLeft" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutConstraintLeft</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutConstraintRight" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutConstraintRight</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutConstraintUp" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutConstraintUp</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutConstraintDown" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutConstraintDown</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutGetScrollToPosition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutGetScrollToPosition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDepthLayoutScrollDirection" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDepthLayoutScrollDirection</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDisplacementEffectUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDisplacementEffectUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDisplacementEffectNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDisplacementEffectNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDisplacementEffectPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDisplacementEffectPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDisplacementEffectTestSetProperty" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDisplacementEffectTestSetProperty</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDistanceFieldEffectUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDistanceFieldEffectUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDistanceFieldEffectPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDistanceFieldEffectPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDistanceFieldEffectDefaultValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDistanceFieldEffectDefaultValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDistanceFieldEffectCustomValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDistanceFieldEffectCustomValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliGaussianBlurViewUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliGaussianBlurViewNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliGaussianBlurViewDownCast" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewDownCast</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliGaussianBlurViewPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliGaussianBlurViewAddRemove" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewAddRemove</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliGaussianBlurActivateDeactivate" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurActivateDeactivate</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliGaussianBlurViewSetGetBackgroundColor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewSetGetBackgroundColor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliGaussianBlurViewSetGetRenderTarget" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliGaussianBlurViewSetGetRenderTarget</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod01" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod01</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod02" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod02</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod03" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod03</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod04" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod04</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod05" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod05</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod06" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod06</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod07" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod07</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod08" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod08</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod09" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod09</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliJsonParserMethod10" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliJsonParserMethod10</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyInputFocusManagerGet" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerGet</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyInputFocusManagerSetFocus" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerSetFocus</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyInputFocusManagerGetCurrentFocusControl" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerGetCurrentFocusControl</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyInputFocusManagerRemoveFocus" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerRemoveFocus</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyInputFocusManagerIsKeyboardListener" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerIsKeyboardListener</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlDownCast" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlDownCast</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlPushItem" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlPushItem</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlPopItem" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlPopItem</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlGetItemCount" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlGetItemCount</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlGetItem" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlGetItem</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlGetCurrentItem" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlGetCurrentItem</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlSetBackground" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlSetBackground</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlCreateNavigationToolBar" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlCreateNavigationToolBar</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationControlCreateNavigationTitleBar" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationControlCreateNavigationTitleBar</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutColumns" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutColumns</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutSetGetOrientation" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetOrientation</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutTestConstraintLeft" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutTestConstraintLeft</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutTestConstraintRight" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutTestConstraintRight</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutTestConstraintUp" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutTestConstraintUp</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutTestConstraintDown" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutTestConstraintDown</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutScrollDirection" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutScrollDirection</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutSetGetColumnSpacing" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetColumnSpacing</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutSetGetTopMargin" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetTopMargin</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutSetGetBottomMargin" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetBottomMargin</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutSetGetScrollSpeedFactor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetScrollSpeedFactor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliNavigationLayoutGetScrollToPosition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliNavigationLayoutGetScrollToPosition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliOverlayConstructor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliOverlayConstructor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliOverlayUninitializedEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliOverlayUninitializedEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageDownCast" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageDownCast</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageSetGetTitle" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageSetGetTitle</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageSetGetSubTitle" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageSetGetSubTitle</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageSetGetTitleIcon" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageSetGetTitleIcon</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageAddGetToolBarControl" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageAddGetToolBarControl</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageAddGetTitleBarControl" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageAddGetTitleBarControl</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageSetGetPopupMenu" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageSetGetPopupMenu</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnEffectApply" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnEffectApply</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnEffectConstruct" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnEffectConstruct</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnPortraitViewNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnPortraitViewNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnLandscapeViewNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnLandscapeViewNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnViewSetAndGetSpineShadowParameter" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewSetAndGetSpineShadowParameter</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnViewGoToPageAndGetCurrentPage" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewGoToPageAndGetCurrentPage</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnViewEnterLeaveEditMode" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewEnterLeaveEditMode</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnViewGetHitActor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewGetHitActor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnViewRefresh" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewRefresh</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliPageTurnViewSignals" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliPageTurnViewSignals</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutSetAndGetRowSpacing" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetRowSpacing</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutSetAndGetItemSizeFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetItemSizeFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutSetAndGetScrollSpeedFactor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetScrollSpeedFactor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutConstraintLeft" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutConstraintLeft</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutConstraintRight" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutConstraintRight</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutConstraintUp" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutConstraintUp</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutConstraintDown" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutConstraintDown</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRollLayoutScrollDirection" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRollLayoutScrollDirection</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRotatingSelectorNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRotatingSelectorSetSelected" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorSetSelected</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorSetSelectedAndUnSelectedActor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRotatingSelectorSetSelectable" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorSetSelectable</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRotatingSelectorSignalSelected" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRotatingSelectorSignalSelected</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewDownCast" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewDownCast</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewScrollToPosition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollToPosition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewScrollToPage" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollToPage</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewScrollToActor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollToActor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewScrollToSnapPoint" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollToSnapPoint</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewRulerScale" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewRulerScale</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewTransformTo" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewTransformTo</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewRefreshInterval" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewRefreshInterval</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewWrapMode" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewWrapMode</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewActorAutoSnap" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewActorAutoSnap</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewSignalsStartComplete" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSignalsStartComplete</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewSignalsUpdate" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSignalsUpdate</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewSignalsClamped" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSignalsClamped</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewScrollSensitive" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewScrollSensitive</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewTouchesRequired" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewTouchesRequired</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewAxisAutoLock" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewAxisAutoLock</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewAxisAutoLockGradient" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewAxisAutoLockGradient</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewConstraints" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewConstraints</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewBind" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewBind</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRulerEnableDisable" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRulerEnableDisable</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRulerDomainEnableDisable" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRulerDomainEnableDisable</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRulerSnapAndClamp" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRulerSnapAndClamp</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliRulerFixedRulerSpacing" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliRulerFixedRulerSpacing</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewOvershoot" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewOvershoot</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewSnapAlphaFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSnapAlphaFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewSnapDuration" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSnapDuration</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewSignalsSnapStart" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSignalsSnapStart</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewSetMouseWheelScrollDistanceStep" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewSetMouseWheelScrollDistanceStep</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewGetSet" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewGetSet</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShadowViewUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShadowViewNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShadowViewDownCast" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewDownCast</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShadowViewPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShadowViewAddRemove" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewAddRemove</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShadowViewActivateDeactivate" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShadowViewActivateDeactivate</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShearEffectUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShearEffectUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShearEffectPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShearEffectPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShearEffectDefaultValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShearEffectDefaultValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliShearEffectCustomValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliShearEffectCustomValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSliderNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSliderNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSliderDestructor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSliderDestructor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSliderDownCast" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSliderDownCast</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSliderSignals" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSliderSignals</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSoftButtonEffectUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSoftButtonEffectUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSoftButtonEffectNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSoftButtonEffectNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSoftButtonEffectPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSoftButtonEffectPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralLayoutNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralSetAndGetItemSizeFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetItemSizeFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralSetAndGetItemSpacing" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetItemSpacing</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralSetAndGetRevolutionDistance" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetRevolutionDistance</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralSetAndGetSpiralRadiusFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetSpiralRadiusFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralSetAndGetTopItemAlignment" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetTopItemAlignment</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralSetAndGetScrollSpeedFactor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetScrollSpeedFactor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralSetAndGetMaximumSwipeSpeed" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralSetAndGetMaximumSwipeSpeed</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutSetAndGetItemFlickAnimationDuration</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralLayoutConstraintLeft" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutConstraintLeft</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralLayoutConstraintRight" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutConstraintRight</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralLayoutConstraintUp" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutConstraintUp</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralLayoutConstraintDown" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutConstraintDown</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralLayoutScrollDirection" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutScrollDirection</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpiralLayoutGetScrollToPosition" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpiralLayoutGetScrollToPosition</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpotUninitializedEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpotUninitializedEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpotPropertyNamesEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpotPropertyNamesEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpotDefaultValuesEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpotDefaultValuesEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSpotCustomValuesEffect" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSpotCustomValuesEffect</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSquareDissolveEffectUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSquareDissolveEffectUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSquareDissolveEffectPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSquareDissolveEffectPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSquareDissolveEffectDefaultValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSquareDissolveEffectDefaultValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliSquareDissolveEffectCustomValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliSquareDissolveEffectCustomValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewMetricsPadding" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewMetricsPadding</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewMetricsFixed" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewMetricsFixed</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewMetricsRelative" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewMetricsRelative</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewAnimation" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewAnimation</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewChild" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewChild</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewAdd" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewAdd</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewCells" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewCells</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewChildAssert" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewChildAssert</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTableViewMetricsAssert" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTableViewMetricsAssert</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliToolBarNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliToolBarSetBackground" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarSetBackground</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliToolBarAddControl01" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarAddControl01</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliToolBarAddControl02" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarAddControl02</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliToolBarRemoveControl01" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarRemoveControl01</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliToolBarRemoveControl02" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliToolBarRemoveControl02</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliViewNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliViewAddGetRemoveContentLayer01" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewAddGetRemoveContentLayer01</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliViewAddGetRemoveContentLayer02" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewAddGetRemoveContentLayer02</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliViewSetGetBackgroundLayer01" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewSetGetBackgroundLayer01</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliViewSetGetBackgroundLayer02" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewSetGetBackgroundLayer02</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliViewSetOrientationFunction" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewSetOrientationFunction</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliViewOrientationChanged" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliViewOrientationChanged</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcSetAutoRotate" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcSetAutoRotate</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectUninitialized" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectUninitialized</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectPropertyNames" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectPropertyNames</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectOutOfBounds" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectOutOfBounds</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectDefaultValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectDefaultValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectCustomValues" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectCustomValues</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectGetAmplitudePositive" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetAmplitudePositive</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectGetAmplitudeNegative" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetAmplitudeNegative</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectGetCenterPositive" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetCenterPositive</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectGetCenterNegative" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetCenterNegative</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectGetPropagationPositive" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetPropagationPositive</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliWaterEffectGetPropagationNegative" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliWaterEffectGetPropagationNegative</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliButtonNew" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliButtonNew</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliButtonProperties" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliButtonProperties</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliButtonSetGetDimmed" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliButtonSetGetDimmed</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliControlImplTypeRegistry" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliControlImplTypeRegistry</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliControlImplMouseWheelEvent" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliControlImplMouseWheelEvent</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliDefaultControlsCreateCheckBoxButton" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliDefaultControlsCreateCheckBoxButton</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliItemViewAddAndGetLayout" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliItemViewAddAndGetLayout</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliItemViewAddAndRemoveLayout" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliItemViewAddAndRemoveLayout</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliItemViewActivateLayoutAndGetActiveLayout" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliItemViewActivateLayoutAndGetActiveLayout</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyboardFocusManagerGet" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyboardFocusManagerGet</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyboardFocusManagerMoveFocus" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyboardFocusManagerMoveFocus</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliKeyboardFocusManagerSignalFocusGroupChanged" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliKeyboardFocusManagerSignalFocusGroupChanged</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewPageCubeEffectSetup" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewPageCubeEffectSetup</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewPageCarouselEffectSetup" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewPageCarouselEffectSetup</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewCarouselEffectSetup" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewCarouselEffectSetup</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewDepthEffectSetup" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewDepthEffectSetup</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewPageCubeEffectTest" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewPageCubeEffectTest</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewPageCarouselEffectTest" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewPageCarouselEffectTest</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewCarouselEffectTest" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewCarouselEffectTest</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliScrollViewDepthEffectTest" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliScrollViewDepthEffectTest</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTextInputSetActiveStyle" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputSetActiveStyle</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTextInputApplyStyleToSelectedText" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputApplyStyleToSelectedText</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTextInputApplyStyleToAll" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputApplyStyleToAll</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTextInputGetStyleAtCursor" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputGetStyleAtCursor</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTextInputSetAndGetTextAlignment" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputSetAndGetTextAlignment</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTextInputSetAndGetMultilinePolicy" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputSetAndGetMultilinePolicy</test_script_entry>
+ </description>
+ </testcase>
+ <testcase component="CoreAPI/DaliToolkit-unmanaged/default" execution_type="auto" id="UtcDaliTextInputSetAndGetExceedEnabled" purpose="">
+ <description>
+ <test_script_entry test_script_expected_result="0">build/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core UtcDaliTextInputSetAndGetExceedEnabled</test_script_entry>
+ </description>
+ </testcase>
+ </set>
+ </suite>
+</test_definition>
+++ /dev/null
-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
+++ /dev/null
-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?
+++ /dev/null
-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
+++ /dev/null
-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 ?
Makefile
dali-toolkit/Makefile
dali-toolkit.pc
- ../../automated-tests/rules.mk
])
AC_OUTPUT