X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-Text-Controller.cpp;h=b92f0903697a4d09957b6c7fe0c3a0e914c8644e;hb=1e86d6f1a754a11410f1d5b89a4520757cb53ff5;hp=748043589aeaabd4db67fd98ba7f960d235dc1df;hpb=aa05fcf7ac4aef5d56a2a581c9103a160c4f052c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp index 7480435..b92f090 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp @@ -22,7 +22,10 @@ #include #include +#include #include +#include +#include using namespace Dali; using namespace Toolkit; @@ -40,32 +43,6 @@ const char* const OPTION_CLIPBOARD("optionClipboard"); // "Clipboard" popup const Size CONTROL_SIZE( 300.f, 60.f ); -class ControlImpl : public ControlInterface -{ -public: - ControlImpl() - : ControlInterface() - {} - - virtual ~ControlImpl() - {} - - virtual void AddDecoration( Actor& actor, bool needsClipping ) - {} - - virtual void RequestTextRelayout() - {} - - virtual void TextChanged() - {} - - virtual void MaxLengthReached() - {} - - virtual void InputStyleChanged( InputStyle::Mask inputStyleMask ) - {} -}; - std::string gClipboardText; void ContentSelectedCallback( ClipboardEventNotifier& notifier ) { @@ -80,11 +57,74 @@ int UtcDaliTextController(void) ToolkitTestApplication application; // Creates a text controller. - ControlImpl controlImpl; - ControllerPtr controller = Controller::New( controlImpl ); + ControllerPtr controller = Controller::New(); + DALI_TEST_CHECK( controller ); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliTextControllerSetGetScrollEnabled(void) +{ + tet_infoline(" UtcDaliTextControllerSetGetScrollEnabled"); + ToolkitTestApplication application; + // Creates a text controller. + ControllerPtr controller = Controller::New(); DALI_TEST_CHECK( controller ); + // Configures the text controller similarly to the text-editor. + ConfigureTextEditor( controller ); + + DALI_TEST_CHECK( !controller->IsHorizontalScrollEnabled() ); + DALI_TEST_CHECK( controller->IsVerticalScrollEnabled() ); + + // Configures the text controller similarly to the text-field. + ConfigureTextField( controller ); + + DALI_TEST_CHECK( controller->IsHorizontalScrollEnabled() ); + DALI_TEST_CHECK( !controller->IsVerticalScrollEnabled() ); + + // Configures the text controller similarly to the text-label. + ConfigureTextLabel( controller ); + + DALI_TEST_CHECK( !controller->IsHorizontalScrollEnabled() ); + DALI_TEST_CHECK( !controller->IsVerticalScrollEnabled() ); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliTextControllerSetIsTextElide(void) +{ + tet_infoline(" UtcDaliTextControllerSetIsTextElide"); + ToolkitTestApplication application; + + // Creates a text controller. + ControllerPtr controller = Controller::New(); + DALI_TEST_CHECK( controller ); + + // Configures the text controller similarly to the text-editor. + ConfigureTextEditor( controller ); + DALI_TEST_EQUALS( false, controller->IsTextElideEnabled(), TEST_LOCATION ); + + controller->SetTextElideEnabled( true ); + DALI_TEST_EQUALS( true, controller->IsTextElideEnabled(), TEST_LOCATION ); + + // Configures the text controller similarly to the text-field. + ConfigureTextField( controller ); + DALI_TEST_EQUALS( false, controller->IsTextElideEnabled(), TEST_LOCATION ); + + controller->SetTextElideEnabled( true ); + DALI_TEST_EQUALS( true, controller->IsTextElideEnabled(), TEST_LOCATION ); + + // Configures the text controller similarly to the text-label. + ConfigureTextLabel( controller ); + DALI_TEST_EQUALS( true, controller->IsTextElideEnabled(), TEST_LOCATION ); + + controller->SetTextElideEnabled( false ); + DALI_TEST_EQUALS( false, controller->IsTextElideEnabled(), TEST_LOCATION ); + tet_result(TET_PASS); END_TEST; } @@ -95,9 +135,7 @@ int UtcDaliTextControllerEnableCursorBlinking(void) ToolkitTestApplication application; // Creates a text controller. - ControlImpl controlImpl; - ControllerPtr controller = Controller::New( controlImpl ); - + ControllerPtr controller = Controller::New(); DALI_TEST_CHECK( controller ); // There is no text input enabled. @@ -131,8 +169,7 @@ int UtcDaliTextControllerImfEvent(void) ToolkitTestApplication application; // Creates a text controller. - ControlImpl controlImpl; - ControllerPtr controller = Controller::New( controlImpl ); + ControllerPtr controller = Controller::New(); std::string text; ImfManager::ImfEventData imfEvent; @@ -214,8 +251,7 @@ int UtcDaliTextControllerTextPopupButtonTouched(void) ToolkitTestApplication application; // Creates a text controller. - ControlImpl controlImpl; - ControllerPtr controller = Controller::New( controlImpl ); + ControllerPtr controller = Controller::New(); DALI_TEST_CHECK( controller ); @@ -330,3 +366,74 @@ int UtcDaliTextControllerTextPopupButtonTouched(void) tet_result(TET_PASS); END_TEST; } + +int UtcDaliTextControllerGetInputShadowProperty(void) +{ + tet_infoline(" UtcDaliTextControllerGetInputShadowProperty"); + ToolkitTestApplication application; + + // Creates a text controller. + ControllerPtr controller = Controller::New(); + + DALI_TEST_CHECK( controller ); + + const std::string& shadowProperties = controller->GetInputShadowProperties(); + + DALI_TEST_CHECK( shadowProperties.empty() ); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliTextControllerGetInputUnderlineProperty(void) +{ + tet_infoline(" UtcDaliTextControllerGetInputUnderlineProperty"); + ToolkitTestApplication application; + + // Creates a text controller. + ControllerPtr controller = Controller::New(); + + DALI_TEST_CHECK( controller ); + + const std::string& underlineProperties = controller->GetInputUnderlineProperties(); + + DALI_TEST_CHECK( underlineProperties.empty() ); + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliTextControllerSetGetAutoScrollEnabled(void) +{ + tet_infoline(" UtcDaliTextControllerSetGetAutoScrollEnabled"); + ToolkitTestApplication application; + + // Creates a text controller. + ControllerPtr controller = Controller::New(); + + DALI_TEST_CHECK( controller ); + + DALI_TEST_CHECK( !controller->IsAutoScrollEnabled() ); + + // The auto scrolling shouldn't be enabled if the multi-line is enabled. + + // Enable multi-line. + controller->SetMultiLineEnabled( true ); + + // Enable text scrolling. + controller->SetAutoScrollEnabled( true ); + + DALI_TEST_CHECK( !controller->IsAutoScrollEnabled() ); + + // Disable multi-line. + controller->SetMultiLineEnabled( false ); + + // Enable text scrolling. + controller->SetAutoScrollEnabled( true ); + + // Should be ebabled now. + DALI_TEST_CHECK( controller->IsAutoScrollEnabled() ); + + tet_result(TET_PASS); + END_TEST; +}