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-TextField.cpp;h=96f02586d70cf28521f3d0c3ffb8fd42a09772f0;hp=07f1cac4ea65b5e9dd2621c9964a92bd6130aaff;hb=09e0a8794f6fd9073bf4889dafc1f3b29b17f6f3;hpb=05e6b5073a18b6ebe1f536a3693300b3ee35b199 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 07f1cac..96f0258 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -101,6 +102,7 @@ const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSe const char* const PROPERTY_NAME_PLACEHOLDER = "placeholder"; const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis"; const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION = "enableShiftSelection"; +const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle"; const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; @@ -119,6 +121,7 @@ const float SCROLL_SPEED = 300.f; const unsigned int DEFAULT_FONT_SIZE = 1152u; const std::string DEFAULT_FONT_DIR( "/resources/fonts" ); +const int KEY_RETURN_CODE = 36; const int KEY_A_CODE = 38; const int KEY_D_CODE = 40; @@ -542,6 +545,7 @@ int UtcDaliTextFieldGetPropertyP(void) DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextField::Property::PLACEHOLDER ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextField::Property::ELLIPSIS ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextField::Property::ENABLE_SHIFT_SELECTION ); + DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextField::Property::ENABLE_GRAB_HANDLE ); END_TEST; } @@ -723,11 +727,11 @@ int UtcDaliTextFieldSetPropertyP(void) Property::Map propertyMap; InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER; InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD; - InputMethod::ActionButtonTitle::Type actionButton = InputMethod::ActionButtonTitle::GO; + InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO; int inputVariation = 1; propertyMap["PANEL_LAYOUT"] = panelLayout; - propertyMap["AUTO_CAPITALISE"] = autoCapital; - propertyMap["ACTION_BUTTON"] = actionButton; + propertyMap["AUTO_CAPITALIZE"] = autoCapital; + propertyMap["BUTTON_ACTION"] = buttonAction; propertyMap["VARIATION"] = inputVariation; field.SetProperty( TextField::Property::INPUT_METHOD_SETTINGS, propertyMap ); @@ -740,12 +744,12 @@ int UtcDaliTextFieldSetPropertyP(void) DALI_TEST_EQUALS( static_cast(panelLayout), layout, TEST_LOCATION ); int capital = 0; - DALI_TEST_CHECK( map[ "AUTO_CAPITALISE" ].Get( capital ) ); + DALI_TEST_CHECK( map[ "AUTO_CAPITALIZE" ].Get( capital ) ); DALI_TEST_EQUALS( static_cast(autoCapital), capital, TEST_LOCATION ); int action = 0; - DALI_TEST_CHECK( map[ "ACTION_BUTTON" ].Get( action ) ); - DALI_TEST_EQUALS( static_cast(actionButton), action, TEST_LOCATION ); + DALI_TEST_CHECK( map[ "BUTTON_ACTION" ].Get( action ) ); + DALI_TEST_EQUALS( static_cast(buttonAction), action, TEST_LOCATION ); int variation = 0; DALI_TEST_CHECK( map[ "VARIATION" ].Get( variation ) ); @@ -1155,6 +1159,11 @@ int utcDaliTextFieldMaxCharactersReachedN(void) DALI_TEST_CHECK( !gMaxCharactersCallBackCalled ); DALI_TEST_CHECK( !maxLengthReachedSignal ); + application.ProcessEvent( GenerateKey( "Return", "\r", KEY_RETURN_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + + DALI_TEST_CHECK( !gMaxCharactersCallBackCalled ); + DALI_TEST_CHECK( !maxLengthReachedSignal ); + END_TEST; } @@ -1631,6 +1640,12 @@ int utcDaliTextFieldEvent01(void) application.SendNotification(); application.Render(); + // Pressing delete key should be fine even if there is no text in TextField. + application.ProcessEvent( GenerateKey( "Delete", "Delete", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + // Render and notify + application.SendNotification(); + application.Render(); + // Now the text field has the focus, so it can handle the key events. application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); @@ -1978,7 +1993,6 @@ int utcDaliTextFieldEvent05(void) application.SendNotification(); application.Render(); - // Tap first to get the focus. application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); @@ -2778,3 +2792,31 @@ int UtcDaliTextFieldEnableShiftSelectionProperty(void) END_TEST; } + +int UtcDaliTextFieldEnableGrabHandleProperty(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextFieldEnableGrabHandleProperty"); + + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + field.SetSize( 300.f, 50.f ); + field.SetParentOrigin( ParentOrigin::TOP_LEFT ); + field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + Stage::GetCurrent().Add( field ); + + application.SendNotification(); + application.Render(); + + // The default value of ENABLE_GRAB_HANDLE is 'true'. + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::ENABLE_GRAB_HANDLE ), true, TEST_LOCATION ); + + // Check the enable grab handle property + field.SetProperty( DevelTextField::Property::ENABLE_GRAB_HANDLE, false ); + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::ENABLE_GRAB_HANDLE ), false, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + END_TEST; +}