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=4808f00546441d80b9b853d246e6fb63aa34ef33;hp=9ff0f659b4345aa55583393fb869dd772fe13a1f;hb=30d94311c9bda0649d18be62f1da3c53014b3a3a;hpb=c35f47a46398a7d71180285e6e52a64243af0a6d diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp old mode 100755 new mode 100644 index 9ff0f65..4808f00 --- 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) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -24,9 +24,11 @@ #include #include +#include #include #include #include +#include #include "toolkit-clipboard.h" using namespace Dali; @@ -101,6 +103,9 @@ const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION = "enableSh const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle"; const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection"; const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup"; +const char* const PROPERTY_NAME_BACKGROUND = "textBackground"; +const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale"; +const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor"; const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f ); const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color. @@ -384,6 +389,23 @@ int UtcDaliToolkitTextFieldCopyConstructorP(void) END_TEST; } +int UtcDaliTextFieldMoveConstructor(void) +{ + ToolkitTestApplication application; + + TextField textField = TextField::New(); + textField.SetProperty( TextEditor::Property::TEXT, "Test" ); + DALI_TEST_CHECK( textField.GetProperty( TextField::Property::TEXT ) == "Test" ); + + TextField moved = std::move( textField ); + DALI_TEST_CHECK( moved ); + DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK( moved.GetProperty( TextField::Property::TEXT ) == "Test" ); + DALI_TEST_CHECK( !textField ); + + END_TEST; +} + int UtcDaliToolkitTextFieldAssignmentOperatorP(void) { ToolkitTestApplication application; @@ -397,6 +419,24 @@ int UtcDaliToolkitTextFieldAssignmentOperatorP(void) END_TEST; } +int UtcDaliTextFieldMoveAssignment(void) +{ + ToolkitTestApplication application; + + TextField textField = TextField::New(); + textField.SetProperty( TextEditor::Property::TEXT, "Test" ); + DALI_TEST_CHECK( textField.GetProperty( TextField::Property::TEXT ) == "Test" ); + + TextField moved; + moved = std::move( textField ); + DALI_TEST_CHECK( moved ); + DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK( moved.GetProperty( TextField::Property::TEXT ) == "Test" ); + DALI_TEST_CHECK( !textField ); + + END_TEST; +} + int UtcDaliTextFieldNewP(void) { ToolkitTestApplication application; @@ -415,7 +455,7 @@ int UtcDaliTextFieldGetPropertyP(void) DALI_TEST_CHECK( field ); // Check Property Indices are correct - DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextField::Property::RENDERING_BACKEND ); + DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == DevelTextField::Property::RENDERING_BACKEND ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextField::Property::TEXT ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == TextField::Property::PLACEHOLDER_TEXT ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_FOCUSED ) == TextField::Property::PLACEHOLDER_TEXT_FOCUSED ); @@ -465,10 +505,13 @@ int UtcDaliTextFieldGetPropertyP(void) DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == TextField::Property::ENABLE_SELECTION ); 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_FONT_SIZE_SCALE ) == DevelTextField::Property::FONT_SIZE_SCALE ); 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 ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP ) == DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP ); + DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextField::Property::BACKGROUND ); + DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_COLOR ) == DevelTextField::Property::GRAB_HANDLE_COLOR ); END_TEST; } @@ -498,13 +541,16 @@ int UtcDaliTextFieldSetPropertyP(void) tet_infoline(" UtcDaliToolkitTextFieldSetPropertyP"); TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); // Note - we can't check the defaults since the stylesheets are platform-specific // Check the render backend property. - field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS ); - DALI_TEST_EQUALS( (Text::RenderingType)field.GetProperty( TextField::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION ); + field.SetProperty( DevelTextField::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS ); + DALI_TEST_EQUALS( (DevelText::RenderingType)field.GetProperty( DevelTextField::Property::RENDERING_BACKEND ), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION ); + + field.SetProperty( DevelTextField::Property::RENDERING_BACKEND, DevelText::RENDERING_VECTOR_BASED ); + DALI_TEST_EQUALS( (DevelText::RenderingType)field.GetProperty( DevelTextField::Property::RENDERING_BACKEND ), DevelText::RENDERING_VECTOR_BASED, TEST_LOCATION ); // Check text property. field.SetProperty( TextField::Property::TEXT, "Setting Text" ); @@ -537,6 +583,10 @@ int UtcDaliTextFieldSetPropertyP(void) field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); DALI_TEST_EQUALS( field.GetProperty( TextField::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + field.SetProperty( DevelTextField::Property::FONT_SIZE_SCALE, 2.5f ); + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + field.SetProperty( DevelTextField::Property::FONT_SIZE_SCALE, 1.0f ); + // Reset font style. fontStyleMapSet.Clear(); fontStyleMapSet.Insert( "weight", "normal" ); @@ -928,6 +978,14 @@ int UtcDaliTextFieldSetPropertyP(void) field.SetProperty( DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP, false ); DALI_TEST_CHECK( !field.GetProperty( DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP ) ); + // Check the background property + field.SetProperty( DevelTextField::Property::BACKGROUND, Color::RED ); + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::BACKGROUND ), Color::RED, TEST_LOCATION ); + + //Check handle color + field.SetProperty( DevelTextField::Property::GRAB_HANDLE_COLOR, Color::GREEN ); + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::GRAB_HANDLE_COLOR ), Color::GREEN, TEST_LOCATION ); + application.SendNotification(); application.Render(); @@ -948,12 +1006,12 @@ int utcDaliTextFieldAtlasRenderP(void) application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); try { // Render some text with the shared atlas backend - field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS ); + field.SetProperty( DevelTextField::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS ); application.SendNotification(); application.Render(); } @@ -972,7 +1030,7 @@ int utcDaliTextFieldTextChangedP(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); // connect to the text changed signal. ConnectionTracker* testTracker = new ConnectionTracker(); @@ -982,20 +1040,113 @@ int utcDaliTextFieldTextChangedP(void) gTextChangedCallBackCalled = false; field.SetProperty( TextField::Property::TEXT, "ABC" ); + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( gTextChangedCallBackCalled ); DALI_TEST_CHECK( textChangedSignal ); + field.SetKeyInputFocus(); + + gTextChangedCallBackCalled = false; + application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + + // Remove all text + field.SetProperty( TextField::Property::TEXT, "" ); + application.SendNotification(); + application.Render(); + + // Pressing backspace key: TextChangedCallback should not be called when there is no text in textfield. + gTextChangedCallBackCalled = false; + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + // Pressing delete key: TextChangedCallback should not be called when there is no text in textfield. + gTextChangedCallBackCalled = false; + application.ProcessEvent( GenerateKey( "", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + END_TEST; +} + +int utcDaliTextFieldTextChangedWithInputMethodContext(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextFieldTextChangedWithInputMethodContext"); + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + + + application.GetScene().Add( field ); + + // connect to the text changed signal. + ConnectionTracker* testTracker = new ConnectionTracker(); + field.TextChangedSignal().Connect(&TestTextChangedCallback); + bool textChangedSignal = false; + field.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) ); + + + // get InputMethodContext + std::string text; + InputMethodContext::EventData imfEvent; + InputMethodContext inputMethodContext = DevelTextField::GetInputMethodContext( field ); field.SetKeyInputFocus(); + field.SetProperty( DevelTextField::Property::ENABLE_EDITING, true ); + + // input text + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "ㅎ", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("ㅎ"), TEST_LOCATION ); + + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "호", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("호"), TEST_LOCATION ); gTextChangedCallBackCalled = false; - application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "혿", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("혿"), TEST_LOCATION ); + + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + imfEvent = InputMethodContext::EventData( InputMethodContext::COMMIT, "호", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "두", 1, 2 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("호두"), TEST_LOCATION ); END_TEST; } + // Negative test for the textChanged signal. int utcDaliTextFieldTextChangedN(void) { @@ -1004,7 +1155,7 @@ int utcDaliTextFieldTextChangedN(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); // connect to the text changed signal. ConnectionTracker* testTracker = new ConnectionTracker(); @@ -1014,6 +1165,8 @@ int utcDaliTextFieldTextChangedN(void) gTextChangedCallBackCalled = false; field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "ABC" ); // Setting placeholder, not TEXT + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( !gTextChangedCallBackCalled ); DALI_TEST_CHECK( !textChangedSignal ); @@ -1028,7 +1181,7 @@ int utcDaliTextFieldMaxCharactersReachedP(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); const int maxNumberOfCharacters = 1; field.SetProperty( TextField::Property::MAX_LENGTH, maxNumberOfCharacters ); @@ -1043,8 +1196,8 @@ int utcDaliTextFieldMaxCharactersReachedP(void) gMaxCharactersCallBackCalled = false; - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); DALI_TEST_CHECK( gMaxCharactersCallBackCalled ); DALI_TEST_CHECK( maxLengthReachedSignal ); @@ -1060,7 +1213,7 @@ int utcDaliTextFieldMaxCharactersReachedN(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); const int maxNumberOfCharacters = 3; field.SetProperty( TextField::Property::MAX_LENGTH, maxNumberOfCharacters ); @@ -1075,13 +1228,13 @@ int utcDaliTextFieldMaxCharactersReachedN(void) gMaxCharactersCallBackCalled = false; - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); DALI_TEST_CHECK( !gMaxCharactersCallBackCalled ); DALI_TEST_CHECK( !maxLengthReachedSignal ); - application.ProcessEvent( GenerateKey( "Return", "", "\r", KEY_RETURN_CODE, 0, 0, Integration::KeyEvent::Down, "\r", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "Return", "", "\r", KEY_RETURN_CODE, 0, 0, Integration::KeyEvent::DOWN, "\r", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); DALI_TEST_CHECK( !gMaxCharactersCallBackCalled ); DALI_TEST_CHECK( !maxLengthReachedSignal ); @@ -1091,15 +1244,13 @@ int utcDaliTextFieldMaxCharactersReachedN(void) int utcDaliTextFieldInputStyleChanged01(void) { - ToolkitTestApplication application; - tet_infoline(" utcDaliTextFieldInputStyleChanged01"); - // The text-field emits signals when the input style changes. These changes of style are // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals // can't be emitted during the size negotiation as the callbacks may update the UI. // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation. - // This creates an implementation of the adaptor stub and a queue of idle callbacks. - application.CreateAdaptor(); + // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks. + ToolkitTestApplication application; + tet_infoline(" utcDaliTextFieldInputStyleChanged01"); // Load some fonts. @@ -1117,9 +1268,9 @@ int utcDaliTextFieldInputStyleChanged01(void) DALI_TEST_CHECK( field ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); field.SetProperty( TextField::Property::ENABLE_MARKUP, true ); field.SetProperty( TextField::Property::TEXT, "Hello world demo" ); @@ -1130,7 +1281,7 @@ int utcDaliTextFieldInputStyleChanged01(void) bool inputStyleChangedSignal = false; field.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); // Render and notify application.SendNotification(); @@ -1302,15 +1453,13 @@ int utcDaliTextFieldInputStyleChanged01(void) int utcDaliTextFieldInputStyleChanged02(void) { - ToolkitTestApplication application; - tet_infoline(" utcDaliTextFieldInputStyleChanged02"); - // The text-field emits signals when the input style changes. These changes of style are // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals // can't be emitted during the size negotiation as the callbacks may update the UI. // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation. - // This creates an implementation of the adaptor stub and a queue of idle callbacks. - application.CreateAdaptor(); + // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks. + ToolkitTestApplication application; + tet_infoline(" utcDaliTextFieldInputStyleChanged02"); // Load some fonts. @@ -1327,9 +1476,9 @@ int utcDaliTextFieldInputStyleChanged02(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); field.SetProperty( TextField::Property::ENABLE_MARKUP, true ); field.SetProperty( TextField::Property::TEXT, "He llo world demo" ); @@ -1340,7 +1489,7 @@ int utcDaliTextFieldInputStyleChanged02(void) bool inputStyleChangedSignal = false; field.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); // Render and notify application.SendNotification(); @@ -1388,7 +1537,7 @@ int utcDaliTextFieldInputStyleChanged02(void) gInputStyleMask = TextField::InputStyle::NONE; inputStyleChangedSignal = false; - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -1413,7 +1562,7 @@ int utcDaliTextFieldInputStyleChanged02(void) gInputStyleMask = TextField::InputStyle::NONE; inputStyleChangedSignal = false; - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -1429,7 +1578,7 @@ int utcDaliTextFieldInputStyleChanged02(void) gInputStyleMask = TextField::InputStyle::NONE; inputStyleChangedSignal = false; - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -1521,11 +1670,11 @@ int utcDaliTextFieldEvent01(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Render and notify application.SendNotification(); @@ -1539,7 +1688,7 @@ int utcDaliTextFieldEvent01(void) application.Render(); // Add a key event but as the text field has not the focus it should do nothing. - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -1555,14 +1704,14 @@ int utcDaliTextFieldEvent01(void) 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, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "Delete", "", "Delete", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", 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, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -1573,12 +1722,12 @@ int utcDaliTextFieldEvent01(void) // Create a second text field and send key events to it. TextField field2 = TextField::New(); - field2.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field2.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - field2.SetSize( 100.f, 100.0f ); - field2.SetPosition( 100.0f, 100.0f ); + field2.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field2.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + field2.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) ); + field2.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); - Stage::GetCurrent().Add( field2 ); + application.GetScene().Add( field2 ); // Render and notify application.SendNotification(); @@ -1592,8 +1741,8 @@ int utcDaliTextFieldEvent01(void) application.Render(); // The second text field has the focus. It should handle the key events. - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -1617,11 +1766,11 @@ int utcDaliTextFieldEvent02(void) DALI_TEST_CHECK( field ); LoadMarkerImages(application, field); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); - field.SetSize( 300.0f, 50.0f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -1644,14 +1793,12 @@ int utcDaliTextFieldEvent02(void) application.Render(); Actor layer = field.GetChildAt( 1u ); - DALI_TEST_CHECK( layer.IsLayer() ); - DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor. DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION ); // 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, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -1673,35 +1820,35 @@ int utcDaliTextFieldEvent02(void) } // Move the cursor and check the position changes. - Vector3 position1 = cursor.GetCurrentPosition(); - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + Vector3 position1 = cursor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); application.Render(); - Vector3 position2 = cursor.GetCurrentPosition(); + Vector3 position2 = cursor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); DALI_TEST_CHECK( position2.x < position1.x ); - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); application.Render(); - Vector3 position3 = cursor.GetCurrentPosition(); + Vector3 position3 = cursor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); DALI_TEST_EQUALS( position1, position3, TEST_LOCATION ); // Should be in the same position1. // Move the cursor to the first position. - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); application.Render(); - Vector3 position4 = cursor.GetCurrentPosition(); + Vector3 position4 = cursor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); // Send some taps and check the cursor positions. @@ -1713,7 +1860,7 @@ int utcDaliTextFieldEvent02(void) application.Render(); // Cursor position should be the same than position1. - Vector3 position5 = cursor.GetCurrentPosition(); + Vector3 position5 = cursor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); DALI_TEST_EQUALS( position4, position5, TEST_LOCATION ); // Should be in the same position2. @@ -1724,13 +1871,13 @@ int utcDaliTextFieldEvent02(void) application.SendNotification(); application.Render(); - Vector3 position6 = cursor.GetCurrentPosition(); + Vector3 position6 = cursor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); DALI_TEST_CHECK( position6.x > position5.x ); // Remove all the text. - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); field.SetProperty( TextField::Property::TEXT, "" ); // Render and notify @@ -1738,7 +1885,7 @@ int utcDaliTextFieldEvent02(void) application.Render(); // Cursor position should be the same than position2. - Vector3 position7 = cursor.GetCurrentPosition(); + Vector3 position7 = cursor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); DALI_TEST_EQUALS( position4, position7, TEST_LOCATION );// Should be in the same position2. @@ -1768,13 +1915,13 @@ int utcDaliTextFieldEvent03(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 30.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 30.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -1825,7 +1972,7 @@ int utcDaliTextFieldEvent04(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); LoadMarkerImages(application, field); // Render and notify application.SendNotification(); @@ -1833,9 +1980,9 @@ int utcDaliTextFieldEvent04(void) field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -1878,7 +2025,7 @@ int utcDaliTextFieldEvent05(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); LoadMarkerImages(application, field); // Render and notify application.SendNotification(); @@ -1886,9 +2033,9 @@ int utcDaliTextFieldEvent05(void) field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -1929,7 +2076,7 @@ int utcDaliTextFieldEvent06(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); LoadMarkerImages(application, field); // Render and notify application.SendNotification(); @@ -1937,9 +2084,9 @@ int utcDaliTextFieldEvent06(void) field.SetProperty( TextField::Property::TEXT, "Thisisalongtextforthesizeofthetextfield." ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -1980,7 +2127,7 @@ int utcDaliTextFieldEvent07(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); LoadMarkerImages(application, field); // Render and notify application.SendNotification(); @@ -1988,9 +2135,9 @@ int utcDaliTextFieldEvent07(void) field.SetProperty( TextField::Property::TEXT, "Thisisalongtextforthesizeofthetextfield." ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); Property::Map propertyMap; propertyMap["PANEL_LAYOUT"] = InputMethod::PanelLayout::PASSWORD; field.SetProperty( TextField::Property::INPUT_METHOD_SETTINGS, propertyMap ); @@ -2023,7 +2170,7 @@ int utcDaliTextFieldEvent08(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); LoadMarkerImages(application, field); // Render and notify application.SendNotification(); @@ -2031,9 +2178,9 @@ int utcDaliTextFieldEvent08(void) field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text" ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2060,13 +2207,13 @@ int utcDaliTextFieldEvent08(void) Wait(application, 500); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); Layer layer = stage.GetRootLayer(); Actor actor = layer.FindChildByName("optionPaste"); if (actor) { - Vector3 worldPosition = actor.GetCurrentWorldPosition(); + Vector3 worldPosition = actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ); Vector2 halfStageSize = stage.GetSize() / 2.0f; Vector2 position(worldPosition.x + halfStageSize.width, worldPosition.y + halfStageSize.height); @@ -2091,7 +2238,7 @@ int utcDaliTextFieldEvent09(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); LoadMarkerImages(application, field); // Render and notify application.SendNotification(); @@ -2099,9 +2246,9 @@ int utcDaliTextFieldEvent09(void) field.SetProperty( TextField::Property::TEXT, "Hello" ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2114,14 +2261,14 @@ int utcDaliTextFieldEvent09(void) Property::Map map; map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::HIDE_NONE; field.SetProperty( TextField::Property::HIDDEN_INPUT_SETTINGS, map ); - application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::Down, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::HIDE_ALL; map[ HiddenInput::Property::SUBSTITUTE_CHARACTER ] = 0x23; field.SetProperty( TextField::Property::HIDDEN_INPUT_SETTINGS, map ); - application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::Down, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); @@ -2130,7 +2277,7 @@ int utcDaliTextFieldEvent09(void) field.SetProperty( TextField::Property::HIDDEN_INPUT_SETTINGS, map ); for( unsigned int index = 0u; index < 5u; ++index ) { - application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::Down, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); } @@ -2140,7 +2287,7 @@ int utcDaliTextFieldEvent09(void) field.SetProperty( TextField::Property::HIDDEN_INPUT_SETTINGS, map ); for( unsigned int index = 0u; index < 5u; ++index ) { - application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::Down, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); } @@ -2148,16 +2295,16 @@ int utcDaliTextFieldEvent09(void) map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::SHOW_LAST_CHARACTER; map[ HiddenInput::Property::SHOW_LAST_CHARACTER_DURATION ] = 0; field.SetProperty( TextField::Property::HIDDEN_INPUT_SETTINGS, map ); - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::Down, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); map[ HiddenInput::Property::SHOW_LAST_CHARACTER_DURATION ] = 100; field.SetProperty( TextField::Property::HIDDEN_INPUT_SETTINGS, map ); - application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::Down, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "d", "", "d", 0, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); @@ -2178,7 +2325,7 @@ int utcDaliTextFieldStyleWhilstSelected(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); LoadMarkerImages(application, field); // Render and notify application.SendNotification(); @@ -2186,9 +2333,9 @@ int utcDaliTextFieldStyleWhilstSelected(void) field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2266,7 +2413,7 @@ int utcDaliTextFieldStyleWhilstSelected(void) DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION ); // Press Escape to increase coverage - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); @@ -2286,11 +2433,11 @@ int utcDaliTextFieldEscKeyLoseFocus(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2300,8 +2447,8 @@ int utcDaliTextFieldEscKeyLoseFocus(void) application.Render(); // Add a key event but as the text field has not the focus it should do nothing. - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -2317,10 +2464,10 @@ int utcDaliTextFieldEscKeyLoseFocus(void) 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, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Up, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::UP, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -2329,8 +2476,8 @@ int utcDaliTextFieldEscKeyLoseFocus(void) DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("ad"), TEST_LOCATION ); // Generate a Esc key event. The text field should lose the focus. - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -2339,8 +2486,8 @@ int utcDaliTextFieldEscKeyLoseFocus(void) DALI_TEST_EQUALS( false, field.HasKeyInputFocus(), TEST_LOCATION ); // No more text should be introduced - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -2360,7 +2507,7 @@ int utcDaliTextFieldSomeSpecialKeys(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); LoadMarkerImages(application, field); // Render and notify application.SendNotification(); @@ -2370,9 +2517,9 @@ int utcDaliTextFieldSomeSpecialKeys(void) field.SetProperty( TextField::Property::TEXT, longText ); field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2402,24 +2549,24 @@ int utcDaliTextFieldSomeSpecialKeys(void) application.Render(); // Generate a Esc key event. The text field should lose the focus. - application.ProcessEvent( GenerateKey( "XF86PowerOff", "", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::Down, "XF86PowerOff", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "XF86PowerOff", "", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::Up, "XF86PowerOff", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "XF86PowerOff", "", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::DOWN, "XF86PowerOff", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "XF86PowerOff", "", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::UP, "XF86PowerOff", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); application.Render(); // Generate a Esc key event. The text field should lose the focus. - application.ProcessEvent( GenerateKey( "XF86Menu", "", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::Down, "XF86Menu", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "XF86Menu", "", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::Up, "XF86Menu", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "XF86Menu", "", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::DOWN, "XF86Menu", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "XF86Menu", "", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::UP, "XF86Menu", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); application.Render(); // Generate a Esc key event. The text field should lose the focus. - application.ProcessEvent( GenerateKey( "XF86Home", "", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::Down, "XF86Home", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "XF86Home", "", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::Up, "XF86Home", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "XF86Home", "", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::DOWN, "XF86Home", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "XF86Home", "", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::UP, "XF86Home", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -2439,7 +2586,7 @@ int utcDaliTextFieldSizeUpdate(void) // Checks some special keys when the text is selected. TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); float previousHeight = 0.0f; float currentHeight = 0.0f; @@ -2447,15 +2594,15 @@ int utcDaliTextFieldSizeUpdate(void) // "ㅁ" is bigger then "ኢ" - field.SetSize( Vector2( fieldWidth ,10.0f ) ); + field.SetProperty( Actor::Property::SIZE, Vector2( fieldWidth ,10.0f ) ); field.SetResizePolicy( ResizePolicy::FIXED , Dimension::WIDTH ); field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY , Dimension::HEIGHT ); field.SetProperty( TextField::Property::TEXT, "ኢ"); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - field.SetKeyboardFocusable(true); + field.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); KeyboardFocusManager::Get().SetCurrentFocusActor( field ); application.SendNotification(); @@ -2465,8 +2612,8 @@ int utcDaliTextFieldSizeUpdate(void) DALI_TEST_EQUALS( previousHeight, field.GetProperty( Actor::Property::SIZE_HEIGHT ) , TEST_LOCATION ); // Add another script characters ( glyph height is defferent ) - application.ProcessEvent( GenerateKey( "ㅁ", "", "ㅁ", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "ㅁ", "", "ㅁ", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "ㅁ", "", "ㅁ", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "ㅁ", "", "ㅁ", KEY_A_CODE, 0, 0, Integration::KeyEvent::UP, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); application.SendNotification(); application.Render(); @@ -2486,10 +2633,10 @@ int utcDaliTextFieldExtremlyLargePointSize(void) TextField field = TextField::New(); field.SetProperty( TextField::Property::TEXT, "Text" ); - field.SetSize( 300.f, 50.f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - Stage::GetCurrent().Add( field ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + application.GetScene().Add( field ); try { @@ -2510,7 +2657,7 @@ int UtcDaliTextFieldDefaultFontStylePropertyCoverage(void) tet_infoline("UtcDaliTextFieldFontStylePorpertyCoverage"); TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); Property::Map fontStyleMapGet; @@ -2536,7 +2683,7 @@ int UtcDaliTextFieldSettingPlaceholder(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); // Check the placeholder property with pixel size Property::Map placeholderPixelSizeMapSet; @@ -2616,10 +2763,10 @@ int UtcDaliTextFieldSetPaddingProperty(void) 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 ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + application.GetScene().Add( field ); application.SendNotification(); application.Render(); @@ -2649,10 +2796,10 @@ int UtcDaliTextFieldEnableShiftSelectionProperty(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - field.SetSize( 300.0f, 50.0f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - Stage::GetCurrent().Add( field ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + application.GetScene().Add( field ); application.SendNotification(); application.Render(); @@ -2677,10 +2824,10 @@ int UtcDaliTextFieldEnableGrabHandleProperty(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - field.SetSize( 300.0f, 50.0f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - Stage::GetCurrent().Add( field ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + application.GetScene().Add( field ); application.SendNotification(); application.Render(); @@ -2705,10 +2852,10 @@ int UtcDaliTextFieldMatchSystemLanguageDirectionProperty(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - field.SetSize( 300.0f, 50.0f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - Stage::GetCurrent().Add( field ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + application.GetScene().Add( field ); application.SendNotification(); application.Render(); @@ -2736,11 +2883,11 @@ int utcDaliTextFieldLayoutDirectionCoverage(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - Stage::GetCurrent().Add( field ); + application.GetScene().Add( field ); - field.SetSize( 300.0f, 50.0f ); - field.SetParentOrigin( ParentOrigin::TOP_LEFT ); - field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2795,8 +2942,8 @@ int utcDaliTextFieldLayoutDirectionCoverage(void) application.Render(); // Generate a Esc key event. The text field should lose the focus. - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); - application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); // Render and notify application.SendNotification(); @@ -2825,11 +2972,11 @@ int UtcDaliTextFieldSelectWholeText(void) TextField textField = TextField::New(); - Stage::GetCurrent().Add( textField ); + application.GetScene().Add( textField ); - textField.SetSize( 300.f, 50.f ); - textField.SetParentOrigin( ParentOrigin::TOP_LEFT ); - textField.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + textField.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + textField.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + textField.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2869,3 +3016,209 @@ int UtcDaliTextFieldSelectWholeText(void) END_TEST; } + +int UtcDaliTextFieldSelectNone(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextFieldSelectWholeText "); + + TextField textField = TextField::New(); + + application.GetScene().Add( textField ); + + textField.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + textField.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + textField.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + application.SendNotification(); + application.Render(); + + textField.SetProperty( TextField::Property::TEXT, "Hello world" ); + + application.SendNotification(); + application.Render(); + + // Nothing is selected + std::string selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get(); + DALI_TEST_EQUALS( "", selectedText, TEST_LOCATION ); + + DevelTextField::SelectWholeText( textField ); + + application.SendNotification(); + application.Render(); + + // whole text is selected + selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get(); + DALI_TEST_EQUALS( "Hello world", selectedText, TEST_LOCATION ); + + DevelTextField::SelectNone( textField ); + + application.SendNotification(); + application.Render(); + + // Nothing is selected + selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get(); + DALI_TEST_EQUALS( "", selectedText, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliTextFieldSelectRange(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextFieldSelectRange "); + + TextField textField = TextField::New(); + + application.GetScene().Add( textField ); + + textField.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + textField.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + textField.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + application.SendNotification(); + application.Render(); + + textField.SetProperty( TextField::Property::TEXT, "Hello world" ); + + application.SendNotification(); + application.Render(); + + textField.SetProperty( DevelTextField::Property::SELECTED_TEXT_START , 0); + textField.SetProperty( DevelTextField::Property::SELECTED_TEXT_END , 5); + + // Hello is selected + std::string selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get(); + DALI_TEST_EQUALS( "Hello", selectedText, TEST_LOCATION ); + + DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::SELECTED_TEXT_START ).Get(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::SELECTED_TEXT_END ).Get(), 5, TEST_LOCATION ); + + textField.SetProperty( DevelTextField::Property::SELECTED_TEXT_START , 6); + textField.SetProperty( DevelTextField::Property::SELECTED_TEXT_END , 11); + + // world is selected + selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get(); + DALI_TEST_EQUALS( "world", selectedText, TEST_LOCATION ); + + DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::SELECTED_TEXT_START ).Get(), 6, TEST_LOCATION ); + DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::SELECTED_TEXT_END ).Get(), 11, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliTextFieldEnableEditing(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextFieldEnableEditing "); + + TextField textField = TextField::New(); + + application.GetScene().Add( textField ); + + textField.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + textField.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + textField.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + application.SendNotification(); + application.Render(); + + textField.SetKeyInputFocus(); + textField.SetProperty( DevelTextField::Property::ENABLE_EDITING, false ); + application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( textField.GetProperty( TextField::Property::TEXT ).Get(), "", TEST_LOCATION ); + DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::ENABLE_EDITING ).Get(), false, TEST_LOCATION ); + + + textField.SetKeyInputFocus(); + textField.SetProperty( DevelTextField::Property::ENABLE_EDITING, true ); + application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( textField.GetProperty( TextField::Property::TEXT ).Get(), "D", TEST_LOCATION ); + DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::ENABLE_EDITING ).Get(), true, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliToolkitTextFieldFontSizeScale(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextFieldFontSizeScale"); + + TextField textField = TextField::New(); + textField.SetProperty( TextField::Property::POINT_SIZE, 30.f ); + textField.SetProperty( TextField::Property::TEXT, "Test" ); + Vector3 nonScaledSize = textField.GetNaturalSize(); + + TextField textFieldScaled = TextField::New(); + textFieldScaled.SetProperty( TextField::Property::POINT_SIZE, 15.f ); + textFieldScaled.SetProperty( Toolkit::DevelTextField::Property::FONT_SIZE_SCALE, 2.f ); + textFieldScaled.SetProperty( TextField::Property::TEXT, "Test" ); + Vector3 scaledSize = textFieldScaled.GetNaturalSize(); + + DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION ); + + textField.SetProperty( TextField::Property::PIXEL_SIZE, 30.f ); + textField.SetProperty( TextField::Property::TEXT, "Test" ); + nonScaledSize = textField.GetNaturalSize(); + + textFieldScaled.SetProperty( TextField::Property::PIXEL_SIZE, 15.f ); + textFieldScaled.SetProperty( Toolkit::DevelTextField::Property::FONT_SIZE_SCALE, 2.f ); + textFieldScaled.SetProperty( TextField::Property::TEXT, "Test" ); + scaledSize = textFieldScaled.GetNaturalSize(); + + DALI_TEST_EQUALS( nonScaledSize, scaledSize, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliTextFieldPrimaryCursorPosition(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextFieldPrimaryCursorPosition "); + + TextField textField = TextField::New(); + + application.GetScene().Add( textField ); + + textField.SetProperty( TextField::Property::TEXT, "ABCEF"); + textField.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) ); + textField.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + textField.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + textField.SetProperty( DevelTextField::Property::PRIMARY_CURSOR_POSITION, 3); + application.SendNotification(); + application.Render(); + + application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( textField.GetProperty( TextField::Property::TEXT ).Get(), "ABCDEF", TEST_LOCATION ); + DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::PRIMARY_CURSOR_POSITION ).Get(), 4, TEST_LOCATION ); + + END_TEST; +}