X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextSelectionPopup.cpp;h=00dce10e70cad9ea4bb6bf31c3fa4f36752eedc9;hp=f8ee78dc43248c8c6f4a5831a9cf011f6aeb0165;hb=HEAD;hpb=f0379552a8e3342b6606f5b64558cd24a7198b6c diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp index f8ee78d..00dce10 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp @@ -28,7 +28,7 @@ using namespace Toolkit; namespace { const char* TEST_IMAGE_FILE_NAME = "selection-popup-border.9.png"; - +const char* TEST_FONT_FAMILY = "BreezeSans"; } void dali_textselectionpopup_startup(void) @@ -139,6 +139,33 @@ int UtcDaliToolkitTextSelectionPopupBackgroundBorderP(void) END_TEST; } +int UtcDaliToolkitTextSelectionPopupBackgroundP(void) +{ + ToolkitTestApplication application; + TextSelectionPopup textSelectionPopup; + textSelectionPopup = TextSelectionPopup::New(NULL); + + textSelectionPopup.SetProperty(TextSelectionPopup::Property::BACKGROUND, + Property::Map().Add(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME)); + + Property::Value value = textSelectionPopup.GetProperty(TextSelectionPopup::Property::BACKGROUND); + + Property::Map map; + value.Get(map); + + Property::Value* returnValue = map.Find(Dali::Toolkit::ImageVisual::Property::URL); + DALI_TEST_CHECK(NULL != returnValue); + + if(returnValue) + { + std::string url; + returnValue->Get(url); + DALI_TEST_EQUALS(TEST_IMAGE_FILE_NAME, url, TEST_LOCATION); + } + + END_TEST; +} + // TextSelectionToolBar is used TextSelectionPopup, below tests it individually int UtcDaliToolkitTextSelectionToolBarP(void) @@ -238,6 +265,7 @@ int UtcDaliToolkitTextSelectionPopupIconProperties(void) popup.SetProperty(TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE, "POPUP_PASTE_BUTTON_ICON_IMAGE"); popup.SetProperty(TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE, "POPUP_SELECT_BUTTON_ICON_IMAGE"); popup.SetProperty(TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE, "POPUP_SELECT_ALL_BUTTON_ICON_IMAGE"); + popup.SetProperty(TextSelectionPopup::Property::POPUP_PRESSED_IMAGE, "POPUP_PRESSED_IMAGE"); DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE).Get(), "POPUP_CLIPBOARD_BUTTON_ICON_IMAGE", TEST_LOCATION); DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE).Get(), "POPUP_CUT_BUTTON_ICON_IMAGE", TEST_LOCATION); @@ -245,6 +273,7 @@ int UtcDaliToolkitTextSelectionPopupIconProperties(void) DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE).Get(), "POPUP_PASTE_BUTTON_ICON_IMAGE", TEST_LOCATION); DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE).Get(), "POPUP_SELECT_BUTTON_ICON_IMAGE", TEST_LOCATION); DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE).Get(), "POPUP_SELECT_ALL_BUTTON_ICON_IMAGE", TEST_LOCATION); + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_PRESSED_IMAGE).Get(), "POPUP_PRESSED_IMAGE", TEST_LOCATION); END_TEST; } @@ -273,3 +302,126 @@ int UtcDaliToolkitTextSelectionPopupSizeProperties(void) END_TEST; } + +int UtcDaliToolkitTextSelectionPopupFloatProperties(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + + const float popupFadeInDuration = 5.0f; + const float popupFadeOutDuration = 10.0f; + const float popupPressedCornerRadius = 15.0f; + popup.SetProperty(TextSelectionPopup::Property::POPUP_FADE_IN_DURATION, popupFadeInDuration); + popup.SetProperty(TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION, popupFadeOutDuration); + popup.SetProperty(TextSelectionPopup::Property::POPUP_PRESSED_CORNER_RADIUS, popupPressedCornerRadius); + + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_FADE_IN_DURATION).Get(), popupFadeInDuration, TEST_LOCATION); + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION).Get(), popupFadeOutDuration, TEST_LOCATION); + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_PRESSED_CORNER_RADIUS).Get(), popupPressedCornerRadius, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliToolkitTextSelectionPopupColorProperties(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + + popup.SetProperty(TextSelectionPopup::Property::POPUP_DIVIDER_COLOR, Color::RED); + popup.SetProperty(TextSelectionPopup::Property::POPUP_ICON_COLOR, Color::BLUE); + popup.SetProperty(TextSelectionPopup::Property::POPUP_PRESSED_COLOR, Color::BLACK); + + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_DIVIDER_COLOR).Get(), Color::RED, TEST_LOCATION); + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_ICON_COLOR).Get(), Color::BLUE, TEST_LOCATION); + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_PRESSED_COLOR).Get(), Color::BLACK, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliToolkitTextSelectionPopupScrollBarP(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + DALI_TEST_CHECK(popup); + + popup.SetProperty(TextSelectionPopup::Property::ENABLE_SCROLL_BAR, true); + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::ENABLE_SCROLL_BAR).Get(), true, TEST_LOCATION); + + popup.SetProperty(TextSelectionPopup::Property::ENABLE_SCROLL_BAR, false); + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::ENABLE_SCROLL_BAR).Get(), false, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliToolkitTextSelectionPopupLabelTextVisualP(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + DALI_TEST_CHECK(popup); + + Property::Map textVisualMapSet; + + textVisualMapSet.Insert(TextVisual::Property::FONT_FAMILY, TEST_FONT_FAMILY); + textVisualMapSet.Insert(TextVisual::Property::POINT_SIZE, 50.f); + textVisualMapSet.Insert(TextVisual::Property::TEXT_COLOR, Color::RED); + + popup.SetProperty(TextSelectionPopup::Property::LABEL_TEXT_VISUAL, textVisualMapSet); + + Property::Map textVisualMapGet; + Property::Map styleMapGet; + + textVisualMapGet = popup.GetProperty(TextSelectionPopup::Property::LABEL_TEXT_VISUAL).Get(); + DALI_TEST_EQUALS(textVisualMapGet.Count(), 3u, TEST_LOCATION); + + Property::Value* returnValue; + + returnValue = textVisualMapGet.Find(TextVisual::Property::FONT_FAMILY); + DALI_TEST_CHECK(NULL != returnValue); + + if(returnValue) + { + std::string fontFamily; + returnValue->Get(fontFamily); + DALI_TEST_EQUALS(fontFamily, TEST_FONT_FAMILY, TEST_LOCATION); + } + + returnValue = textVisualMapGet.Find(TextVisual::Property::POINT_SIZE); + DALI_TEST_CHECK(NULL != returnValue); + + if(returnValue) + { + float pointSize; + returnValue->Get(pointSize); + DALI_TEST_EQUALS(pointSize, 50.0f, TEST_LOCATION); + } + + returnValue = textVisualMapGet.Find(TextVisual::Property::TEXT_COLOR); + DALI_TEST_CHECK(NULL != returnValue); + + if(returnValue) + { + Vector4 textColor; + returnValue->Get(textColor); + DALI_TEST_EQUALS(textColor, Color::RED, TEST_LOCATION); + } + + END_TEST; +} + +int UtcDaliToolkitTextSelectionPopupLabelProperties(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + DALI_TEST_CHECK(popup); + + const Vector2 labelMinimumSize(100.0f, 50.0f); + const Vector4 labelPadding(10.0f, 20.0f, 30.0f, 40.0f); + + popup.SetProperty(TextSelectionPopup::Property::LABEL_MINIMUM_SIZE, labelMinimumSize); + popup.SetProperty(TextSelectionPopup::Property::LABEL_PADDING, labelPadding); + + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::LABEL_MINIMUM_SIZE).Get(), labelMinimumSize, TEST_LOCATION); + DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::LABEL_PADDING).Get(), labelPadding, TEST_LOCATION); + + END_TEST; +} \ No newline at end of file