(Automated Tests) Use Scene instead of Stage
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextEditor.cpp
old mode 100755 (executable)
new mode 100644 (file)
index c84000d..51b1cd7
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -27,6 +27,7 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
+#include <dali-toolkit/devel-api/text/rendering-backend.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -390,7 +391,7 @@ int UtcDaliTextEditorGetPropertyP(void)
   DALI_TEST_CHECK( editor );
 
   // Check Property Indices are correct
-  DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextEditor::Property::RENDERING_BACKEND );
+  DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == DevelTextEditor::Property::RENDERING_BACKEND );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextEditor::Property::TEXT );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextEditor::Property::TEXT_COLOR );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextEditor::Property::FONT_FAMILY );
@@ -474,13 +475,13 @@ int UtcDaliTextEditorSetPropertyP(void)
   tet_infoline(" UtcDaliToolkitTextEditorSetPropertyP");
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   // Note - we can't check the defaults since the stylesheets are platform-specific
 
   // Check the render backend property.
-  editor.SetProperty( TextEditor::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
-  DALI_TEST_EQUALS( (Text::RenderingType)editor.GetProperty<int>( TextEditor::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
+  editor.SetProperty( DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
+  DALI_TEST_EQUALS( (DevelText::RenderingType)editor.GetProperty<int>( DevelTextEditor::Property::RENDERING_BACKEND ), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION );
 
   // Check text property.
   editor.SetProperty( TextEditor::Property::TEXT, "Setting Text" );
@@ -875,12 +876,12 @@ int utcDaliTextEditorAtlasRenderP(void)
 
   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   try
   {
     // Render some text with the shared atlas backend
-    editor.SetProperty( TextEditor::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
+    editor.SetProperty( DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS );
     application.SendNotification();
     application.Render();
   }
@@ -899,7 +900,7 @@ int utcDaliTextEditorTextChangedP(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   // connect to the text changed signal.
   ConnectionTracker* testTracker = new ConnectionTracker();
@@ -962,7 +963,7 @@ int utcDaliTextEditorInputStyleChanged01(void)
   bool inputStyleChangedSignal = false;
   editor.ConnectSignal( testTracker, "inputStyleChanged",   CallbackFunctor(&inputStyleChangedSignal) );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   // Render and notify
   application.SendNotification();
@@ -1176,7 +1177,7 @@ int utcDaliTextEditorInputStyleChanged02(void)
   bool inputStyleChangedSignal = false;
   editor.ConnectSignal( testTracker, "inputStyleChanged",   CallbackFunctor(&inputStyleChangedSignal) );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   // Render and notify
   application.SendNotification();
@@ -1398,7 +1399,7 @@ int utcDaliTextEditorEvent01(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
   editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
@@ -1445,7 +1446,7 @@ int utcDaliTextEditorEvent01(void)
   editor2.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
   editor2.SetProperty( Actor::Property::POSITION, Vector2( 100.f, 100.f ));
 
-  Stage::GetCurrent().Add( editor2 );
+  application.GetScene().Add( editor2 );
 
   // Render and notify
   application.SendNotification();
@@ -1483,7 +1484,7 @@ int utcDaliTextEditorEvent02(void)
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
   editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
@@ -1509,7 +1510,7 @@ int utcDaliTextEditorEvent02(void)
   application.Render();
 
   Actor layer = editor.GetChildAt( 1u );
-  DALI_TEST_CHECK( layer.IsLayer() );
+  DALI_TEST_CHECK( layer.GetProperty< bool >( Actor::Property::IS_LAYER ) );
 
   DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
   DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
@@ -1617,7 +1618,7 @@ int utcDaliTextEditorEvent03(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::TEXT, "This is a long text for the size of the text-editor." );
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
@@ -1710,7 +1711,7 @@ int utcDaliTextEditorEvent04(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworl" );
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
@@ -1799,7 +1800,7 @@ int utcDaliTextEditorEvent05(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworl" );
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
@@ -1881,7 +1882,7 @@ int utcDaliTextEditorEvent06(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
@@ -1971,7 +1972,7 @@ int utcDaliTextEditorEvent07(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
@@ -2115,7 +2116,7 @@ int utcDaliTextEditorEvent08(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::TEXT, "DALi" );
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
@@ -2309,7 +2310,7 @@ int utcDaliTextEditorHandles(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::TEXT, "This is a long text for the size of the text-editor." );
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
@@ -2428,7 +2429,7 @@ int utcDaliTextEditorUnderPropertyStringP(void)
 
   std::string underlineSettings1( "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}" );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettings1 );
   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::UNDERLINE ), underlineSettings1, TEST_LOCATION );
@@ -2472,7 +2473,7 @@ int utcDaliTextEditorShadowPropertyStringP(void)
 
   std::string shadowSettings( "{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}" );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}" );
 
@@ -2494,7 +2495,7 @@ int utcDaliTextEditorFontStylePropertyStringP(void)
 
   std::string fontStyleSettings( "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
 
@@ -2520,7 +2521,7 @@ int utcDaliTextEditorGetPropertyLinecountP(void)
   editor.SetProperty( TextEditor::Property::TEXT,
                        "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
   lineCount =  editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
@@ -2542,14 +2543,14 @@ int utcDaliTextEditorScrollStateChangedSignalTest(void)
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
   editor.SetProperty( Actor::Property::SIZE, Vector2( 50.f, 50.f ) );
   editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
   editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
   editor.SetProperty( TextEditor::Property::ENABLE_SCROLL_BAR, true );
-  editor.SetKeyboardFocusable(true);
+  editor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
 
   bool startedCalled = false;
   bool finishedCalled = false;
@@ -2585,7 +2586,7 @@ int UtcDaliToolkitTextEditorTextWrapMode(void)
   editor.SetProperty( Actor::Property::SIZE, Vector2( 150.0f, 300.f ) );
   editor.SetProperty( TextEditor::Property::TEXT, "Hello world Hello world" );
 
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "WORD" );
   DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
@@ -2636,7 +2637,7 @@ int UtcDaliTextEditorSetPaddingProperty(void)
   editor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
   editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
   editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   application.SendNotification();
   application.Render();
@@ -2669,7 +2670,7 @@ int UtcDaliTextEditorEnableShiftSelectionProperty(void)
   editor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
   editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
   editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   application.SendNotification();
   application.Render();
@@ -2697,7 +2698,7 @@ int UtcDaliTextEditorEnableGrabHandleProperty(void)
   editor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
   editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
   editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   application.SendNotification();
   application.Render();
@@ -2725,7 +2726,7 @@ int UtcDaliTextEditorMatchSystemLanguageDirectionProperty(void)
   editor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
   editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
   editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
-  Stage::GetCurrent().Add( editor );
+  application.GetScene().Add( editor );
 
   application.SendNotification();
   application.Render();