From e40e3dde6078d60e810a2df45d5b3daf3440a7db Mon Sep 17 00:00:00 2001 From: Jahangir Date: Thu, 16 Jun 2016 11:53:22 -0400 Subject: [PATCH] [ITC][dali-toolkit][ACR-647][Modified TC according to ACR] Change-Id: I4dab3f29be3cb950e4873abeab17897563cd44b2 --- .../tct-dali-toolkit-native_common_iot.h | 6 +- .../dali-toolkit/tct-dali-toolkit-native_mobile.h | 6 +- src/itc/dali-toolkit/tct-dali-toolkit-native_tv.h | 6 +- .../tct-dali-toolkit-native_wearable.h | 6 +- src/itc/dali-toolkit/text-label/ITs-text-label.cpp | 115 ++++++++++++++------- 5 files changed, 91 insertions(+), 48 deletions(-) diff --git a/src/itc/dali-toolkit/tct-dali-toolkit-native_common_iot.h b/src/itc/dali-toolkit/tct-dali-toolkit-native_common_iot.h index 6916a69..173a735 100755 --- a/src/itc/dali-toolkit/tct-dali-toolkit-native_common_iot.h +++ b/src/itc/dali-toolkit/tct-dali-toolkit-native_common_iot.h @@ -73,7 +73,7 @@ extern void ITs_text_label_startup(void); extern void ITs_text_label_cleanup(void); extern void ITs_toolkit_startup(void); extern void ITs_toolkit_cleanup(void); - +//~ extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityLabel(void); extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityTrait(void); extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityValue(void); @@ -304,7 +304,7 @@ extern int ITcTextFieldAssignment(void); extern int ITcTextFieldCopy(void); extern int ITcTextFieldTextChangedSignal(void); extern int ITcTextLabelNewDownCast(void); -extern int ITcTextLabelNewWithTextAssignment(void); +extern int ITcTextLabelGetSetPropertiesWithAssignment(void); extern int ITcTextLabelNewWithTextCopy(void); extern int ITcToolkitIsVertical(void); extern int ITcToolkitIsHorizontal(void); @@ -542,7 +542,7 @@ testcase tc_array[] = { {"ITcTextFieldCopy", ITcTextFieldCopy, ITs_text_field_startup, ITs_text_field_cleanup}, {"ITcTextFieldTextChangedSignal", ITcTextFieldTextChangedSignal, ITs_text_field_startup, ITs_text_field_cleanup}, {"ITcTextLabelNewDownCast", ITcTextLabelNewDownCast, ITs_text_label_startup, ITs_text_label_cleanup}, - {"ITcTextLabelNewWithTextAssignment", ITcTextLabelNewWithTextAssignment, ITs_text_label_startup, ITs_text_label_cleanup}, + {"ITcTextLabelGetSetPropertiesWithAssignment", ITcTextLabelGetSetPropertiesWithAssignment, ITs_text_label_startup, ITs_text_label_cleanup}, {"ITcTextLabelNewWithTextCopy", ITcTextLabelNewWithTextCopy, ITs_text_label_startup, ITs_text_label_cleanup}, {"ITcToolkitIsVertical", ITcToolkitIsVertical, ITs_toolkit_startup, ITs_toolkit_cleanup}, {"ITcToolkitIsHorizontal", ITcToolkitIsHorizontal, ITs_toolkit_startup, ITs_toolkit_cleanup}, diff --git a/src/itc/dali-toolkit/tct-dali-toolkit-native_mobile.h b/src/itc/dali-toolkit/tct-dali-toolkit-native_mobile.h index 6916a69..173a735 100755 --- a/src/itc/dali-toolkit/tct-dali-toolkit-native_mobile.h +++ b/src/itc/dali-toolkit/tct-dali-toolkit-native_mobile.h @@ -73,7 +73,7 @@ extern void ITs_text_label_startup(void); extern void ITs_text_label_cleanup(void); extern void ITs_toolkit_startup(void); extern void ITs_toolkit_cleanup(void); - +//~ extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityLabel(void); extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityTrait(void); extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityValue(void); @@ -304,7 +304,7 @@ extern int ITcTextFieldAssignment(void); extern int ITcTextFieldCopy(void); extern int ITcTextFieldTextChangedSignal(void); extern int ITcTextLabelNewDownCast(void); -extern int ITcTextLabelNewWithTextAssignment(void); +extern int ITcTextLabelGetSetPropertiesWithAssignment(void); extern int ITcTextLabelNewWithTextCopy(void); extern int ITcToolkitIsVertical(void); extern int ITcToolkitIsHorizontal(void); @@ -542,7 +542,7 @@ testcase tc_array[] = { {"ITcTextFieldCopy", ITcTextFieldCopy, ITs_text_field_startup, ITs_text_field_cleanup}, {"ITcTextFieldTextChangedSignal", ITcTextFieldTextChangedSignal, ITs_text_field_startup, ITs_text_field_cleanup}, {"ITcTextLabelNewDownCast", ITcTextLabelNewDownCast, ITs_text_label_startup, ITs_text_label_cleanup}, - {"ITcTextLabelNewWithTextAssignment", ITcTextLabelNewWithTextAssignment, ITs_text_label_startup, ITs_text_label_cleanup}, + {"ITcTextLabelGetSetPropertiesWithAssignment", ITcTextLabelGetSetPropertiesWithAssignment, ITs_text_label_startup, ITs_text_label_cleanup}, {"ITcTextLabelNewWithTextCopy", ITcTextLabelNewWithTextCopy, ITs_text_label_startup, ITs_text_label_cleanup}, {"ITcToolkitIsVertical", ITcToolkitIsVertical, ITs_toolkit_startup, ITs_toolkit_cleanup}, {"ITcToolkitIsHorizontal", ITcToolkitIsHorizontal, ITs_toolkit_startup, ITs_toolkit_cleanup}, diff --git a/src/itc/dali-toolkit/tct-dali-toolkit-native_tv.h b/src/itc/dali-toolkit/tct-dali-toolkit-native_tv.h index 6916a69..173a735 100755 --- a/src/itc/dali-toolkit/tct-dali-toolkit-native_tv.h +++ b/src/itc/dali-toolkit/tct-dali-toolkit-native_tv.h @@ -73,7 +73,7 @@ extern void ITs_text_label_startup(void); extern void ITs_text_label_cleanup(void); extern void ITs_toolkit_startup(void); extern void ITs_toolkit_cleanup(void); - +//~ extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityLabel(void); extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityTrait(void); extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityValue(void); @@ -304,7 +304,7 @@ extern int ITcTextFieldAssignment(void); extern int ITcTextFieldCopy(void); extern int ITcTextFieldTextChangedSignal(void); extern int ITcTextLabelNewDownCast(void); -extern int ITcTextLabelNewWithTextAssignment(void); +extern int ITcTextLabelGetSetPropertiesWithAssignment(void); extern int ITcTextLabelNewWithTextCopy(void); extern int ITcToolkitIsVertical(void); extern int ITcToolkitIsHorizontal(void); @@ -542,7 +542,7 @@ testcase tc_array[] = { {"ITcTextFieldCopy", ITcTextFieldCopy, ITs_text_field_startup, ITs_text_field_cleanup}, {"ITcTextFieldTextChangedSignal", ITcTextFieldTextChangedSignal, ITs_text_field_startup, ITs_text_field_cleanup}, {"ITcTextLabelNewDownCast", ITcTextLabelNewDownCast, ITs_text_label_startup, ITs_text_label_cleanup}, - {"ITcTextLabelNewWithTextAssignment", ITcTextLabelNewWithTextAssignment, ITs_text_label_startup, ITs_text_label_cleanup}, + {"ITcTextLabelGetSetPropertiesWithAssignment", ITcTextLabelGetSetPropertiesWithAssignment, ITs_text_label_startup, ITs_text_label_cleanup}, {"ITcTextLabelNewWithTextCopy", ITcTextLabelNewWithTextCopy, ITs_text_label_startup, ITs_text_label_cleanup}, {"ITcToolkitIsVertical", ITcToolkitIsVertical, ITs_toolkit_startup, ITs_toolkit_cleanup}, {"ITcToolkitIsHorizontal", ITcToolkitIsHorizontal, ITs_toolkit_startup, ITs_toolkit_cleanup}, diff --git a/src/itc/dali-toolkit/tct-dali-toolkit-native_wearable.h b/src/itc/dali-toolkit/tct-dali-toolkit-native_wearable.h index 6916a69..173a735 100755 --- a/src/itc/dali-toolkit/tct-dali-toolkit-native_wearable.h +++ b/src/itc/dali-toolkit/tct-dali-toolkit-native_wearable.h @@ -73,7 +73,7 @@ extern void ITs_text_label_startup(void); extern void ITs_text_label_cleanup(void); extern void ITs_toolkit_startup(void); extern void ITs_toolkit_cleanup(void); - +//~ extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityLabel(void); extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityTrait(void); extern int ITcAccessibilityManagerSetGetAccessibilityAttributeWithAccessibilityValue(void); @@ -304,7 +304,7 @@ extern int ITcTextFieldAssignment(void); extern int ITcTextFieldCopy(void); extern int ITcTextFieldTextChangedSignal(void); extern int ITcTextLabelNewDownCast(void); -extern int ITcTextLabelNewWithTextAssignment(void); +extern int ITcTextLabelGetSetPropertiesWithAssignment(void); extern int ITcTextLabelNewWithTextCopy(void); extern int ITcToolkitIsVertical(void); extern int ITcToolkitIsHorizontal(void); @@ -542,7 +542,7 @@ testcase tc_array[] = { {"ITcTextFieldCopy", ITcTextFieldCopy, ITs_text_field_startup, ITs_text_field_cleanup}, {"ITcTextFieldTextChangedSignal", ITcTextFieldTextChangedSignal, ITs_text_field_startup, ITs_text_field_cleanup}, {"ITcTextLabelNewDownCast", ITcTextLabelNewDownCast, ITs_text_label_startup, ITs_text_label_cleanup}, - {"ITcTextLabelNewWithTextAssignment", ITcTextLabelNewWithTextAssignment, ITs_text_label_startup, ITs_text_label_cleanup}, + {"ITcTextLabelGetSetPropertiesWithAssignment", ITcTextLabelGetSetPropertiesWithAssignment, ITs_text_label_startup, ITs_text_label_cleanup}, {"ITcTextLabelNewWithTextCopy", ITcTextLabelNewWithTextCopy, ITs_text_label_startup, ITs_text_label_cleanup}, {"ITcToolkitIsVertical", ITcToolkitIsVertical, ITs_toolkit_startup, ITs_toolkit_cleanup}, {"ITcToolkitIsHorizontal", ITcToolkitIsHorizontal, ITs_toolkit_startup, ITs_toolkit_cleanup}, diff --git a/src/itc/dali-toolkit/text-label/ITs-text-label.cpp b/src/itc/dali-toolkit/text-label/ITs-text-label.cpp index f95ffc7..5950921 100755 --- a/src/itc/dali-toolkit/text-label/ITs-text-label.cpp +++ b/src/itc/dali-toolkit/text-label/ITs-text-label.cpp @@ -36,16 +36,16 @@ void ITs_text_label_cleanup(void) */ void TextLabelNewDownCast(); -void TextLabelNewWithTextAssignment(); +void TextLabelGetSetPropertiesWithAssignment(); void TextLabelNewWithTextCopy(); namespace { enum TEST_CASES_LIST_TEXT_LABEL { - TEXT_LABEL_NEW_DOWNCAST, - TEXT_LABEL_NEW_WITH_TEXT_ASSIGNMENT, - TEXT_LABEL_NEW_WITH_TEXT_COPY + TEXT_LABEL_NEW_DOWNCAST, + TEXT_LABEL_GET_SET_PROPERTIES_WITH_ASSIGNMENT, + TEXT_LABEL_NEW_WITH_TEXT_COPY }; struct TextLabel_TestApp : public ConnectionTracker @@ -81,9 +81,9 @@ namespace TextLabelNewDownCast(); break; } - case TEXT_LABEL_NEW_WITH_TEXT_ASSIGNMENT: + case TEXT_LABEL_GET_SET_PROPERTIES_WITH_ASSIGNMENT: { - TextLabelNewWithTextAssignment(); + TextLabelGetSetPropertiesWithAssignment(); break; } case TEXT_LABEL_NEW_WITH_TEXT_COPY: @@ -130,38 +130,81 @@ void TextLabelNewDownCast() DaliLog::PrintPass(); } -void TextLabelNewWithTextAssignment() +void TextLabelGetSetPropertiesWithAssignment() { OPEN_GL_FREATURE_CHECK(SUITE_NAME,__LINE__) - TextLabel textLabelAssign; - const string STR_TEXT = "DALi Toolkit Text Label"; - const string STR_HORIZONAL = "END"; - const string STR_VERTICAL = "CENTER"; - bool bMultyLine = true, bMultyLineGet = false; - - string strTextGet = "", strHorAlignGet = "", strVertAlignGet = ""; - - TextLabel textLabel = TextLabel::New( STR_TEXT ); - DALI_CHECK_INSTANCE( textLabel, "TextLabel::New(const string&) is failed." ); - - textLabel.SetProperty( TextLabel::Property::MULTI_LINE, bMultyLine ); - textLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, STR_HORIZONAL ); - textLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, STR_VERTICAL ); - - textLabelAssign = textLabel; - DALI_CHECK_INSTANCE( textLabelAssign, "TextLabel handle is empty after assignment." ); - - strTextGet = textLabelAssign.GetProperty( TextLabel::Property::TEXT ); - DALI_CHECK_FAIL( strTextGet != STR_TEXT, "TextLabel::operator= is failed along with set text." ); - bMultyLineGet = textLabelAssign.GetProperty( TextLabel::Property::MULTI_LINE ); - DALI_CHECK_FAIL( bMultyLineGet != bMultyLine, "TextLabel::operator= is failed along with set multy line status." ); + const int SCROLL_SPEED = 80; + const int SCROLL_LOOPS = 4; + const float SCROLL_GAP = 50.0f; + const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL = "enableAutoScroll"; + const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED = "autoScrollSpeed"; + const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS = "autoScrollLoopCount"; + const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP = "autoScrollGap"; + + TextLabel label = TextLabel::New(); + DALI_CHECK_INSTANCE( label, "TextLabel::New() is failed." ); + + label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS ); + DALI_CHECK_FAIL( (Text::RenderingType)label.GetProperty( TextLabel::Property::RENDERING_BACKEND ) != Text::RENDERING_SHARED_ATLAS, "TextLabel rendering set/get failed."); + + label.SetProperty( TextLabel::Property::TEXT, "Setting Text" ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::TEXT ) != std::string("Setting Text"), "TextLabel text set/get failed." ); + + label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::FONT_FAMILY ) != std::string("Setting font family"), "TextLabel font family set/get failed." ); + label.SetProperty( TextLabel::Property::FONT_STYLE, "Setting font style" ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::FONT_STYLE ) != std::string("Setting font style"), "TextLabel font style set/get failed." ); + label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::POINT_SIZE ) != 10.f, "TextLabel point size set/get failed." ); + + label.SetProperty( TextLabel::Property::MULTI_LINE, true ); + DALI_CHECK_FAIL( !label.GetProperty( TextLabel::Property::MULTI_LINE ), "TextLabel multiline set/get failed." ); + + label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT ) != "CENTER", "TextLabel horizontal alignment set/get failed." ); + label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::VERTICAL_ALIGNMENT ) != "CENTER", "TextLabel vertical alignment set/get failed." ); + + label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::TEXT_COLOR ) != Color::BLUE, "TextLabel color set/get failed." ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::UNDERLINE_COLOR ) != Color::BLUE, "TextLabel color set/get failed." ); + + label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 3.0f, 3.0f ) ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::SHADOW_OFFSET ) != Vector2( 3.0f, 3.0f ), "TextLabel shadoe offset set/get failed." ); + label.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLUE ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::SHADOW_COLOR ) != Color::BLUE, "TextLabel shadow color set/get failed." ); + + label.SetProperty( TextLabel::Property::UNDERLINE_ENABLED, true ); + DALI_CHECK_FAIL( !label.GetProperty( TextLabel::Property::UNDERLINE_ENABLED ), "TextLabel underline enable set/get failed." ); + label.SetProperty( TextLabel::Property::UNDERLINE_COLOR, Color::RED ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::UNDERLINE_COLOR ) != Color::RED, "TextLabel underline color set/get failed." ); + label.SetProperty( TextLabel::Property::UNDERLINE_HEIGHT, 1.0f ); + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::UNDERLINE_HEIGHT ) != 1.0f, "TextLabel underline height set/get failed." ); + + TextLabel label2 = TextLabel::New( "New text" ); + DALI_CHECK_FAIL( !label2,"TextLabel TextLabel::New(const string) failed."); + DALI_CHECK_FAIL( label2.GetProperty( TextLabel::Property::TEXT ) != std::string("New text"), "TextLabel text set/get failed." ); + + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::ENABLE_MARKUP ),"TextLabel enable markup failed." ); + label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true ); + DALI_CHECK_FAIL( !label.GetProperty( TextLabel::Property::ENABLE_MARKUP ),"TextLabel enable markup set/get failed." ); + + label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line + DALI_CHECK_FAIL( label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ), "TextLabel enable auto scroll failed." ); + label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + DALI_CHECK_FAIL( !label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ),"TextLabel enable auto scroll set/get failed." ); + label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, SCROLL_SPEED ); + DALI_CHECK_FAIL( SCROLL_SPEED != label.GetProperty( TextLabel::Property::AUTO_SCROLL_SPEED ), "TextLabel auto scroll speed set/get failed." ); + label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, SCROLL_LOOPS ); + DALI_CHECK_FAIL( SCROLL_LOOPS != label.GetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), "TextLabel auto scroll loop set/get failed." ); + label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP ); + DALI_CHECK_FAIL( SCROLL_GAP != label.GetProperty( TextLabel::Property::AUTO_SCROLL_GAP ), "TextLabel auto scroll gap set/get failed." ); - strHorAlignGet = textLabelAssign.GetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT ); - DALI_CHECK_FAIL( strHorAlignGet != STR_HORIZONAL, "TextLabel::operator= is failed along with set horizontal alignment." ); - - strVertAlignGet = textLabelAssign.GetProperty( TextLabel::Property:: VERTICAL_ALIGNMENT ); - DALI_CHECK_FAIL( strHorAlignGet != STR_HORIZONAL, "TextLabel::operator= is failed along with set vertical alignment." ); + DALI_CHECK_FAIL( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL ) != TextLabel::Property::ENABLE_AUTO_SCROLL ,"Index of enable auto scroll not match"); + DALI_CHECK_FAIL( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) != TextLabel::Property::AUTO_SCROLL_SPEED ,"Index of auto scroll speed not match"); + DALI_CHECK_FAIL( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) != TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ,"Index of auto loop count not match"); + DALI_CHECK_FAIL( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) != TextLabel::Property::AUTO_SCROLL_GAP ,"Index of auto scroll gap not match"); DaliLog::PrintPass(); } @@ -266,12 +309,12 @@ int ITcTextLabelNewDownCast(void) * @postcondition NA */ -int ITcTextLabelNewWithTextAssignment(void) +int ITcTextLabelGetSetPropertiesWithAssignment(void) { DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__); Application application = Application::New( &gArgc, &gArgv ); - TextLabel_TestApp testApp( application, TEXT_LABEL_NEW_WITH_TEXT_ASSIGNMENT ); + TextLabel_TestApp testApp( application, TEXT_LABEL_GET_SET_PROPERTIES_WITH_ASSIGNMENT ); application.MainLoop(); return test_return_value; -- 2.7.4