[AT-SPI] Catch exception by reference
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-TextField-internal.cpp
index e9eff1c..37d54e1 100755 (executable)
@@ -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.
@@ -41,7 +41,7 @@ int UtcDaliTextFieldMultipleBackgroundText(void)
   textField.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
 
   // Add the text field to the stage
-  Stage::GetCurrent().Add( textField );
+  application.GetScene().Add( textField );
 
   application.SendNotification();
   application.Render();
@@ -112,3 +112,43 @@ int UtcDaliTextFieldMultipleBackgroundText(void)
 
   END_TEST;
 }
+
+int UtcDaliTextFieldSelectText(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliTextFieldSelectText" );
+
+  // Create a text field
+  TextField textField = TextField::New();
+  textField.SetProperty( Actor::Property::SIZE, Vector2( 400.f, 60.f ) );
+  textField.SetProperty( TextField::Property::TEXT, "Hello World" );
+
+  // Add the text field to the stage
+  application.GetScene().Add( textField );
+
+  application.SendNotification();
+  application.Render();
+
+  Toolkit::Internal::TextField& textFieldImpl = GetImpl( textField );
+
+  application.SendNotification();
+  application.Render();
+
+  // Highlight the whole text
+  textFieldImpl.SelectWholeText();
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( textFieldImpl.GetSelectedText() == "Hello World" );
+
+  // Select None
+  textFieldImpl.SelectNone();
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( textFieldImpl.GetSelectedText() == "" );
+
+  END_TEST;
+}