Updating code formatting
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextSelectionPopup.cpp
index 11b9f46..f8ee78d 100644 (file)
  *
  */
 
-#include <iostream>
-#include <stdlib.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
+#include <stdlib.h>
+#include <iostream>
 
 using namespace Dali;
 using namespace Toolkit;
 
 namespace
 {
-
 const char* TEST_IMAGE_FILE_NAME = "selection-popup-border.9.png";
 
 }
@@ -45,13 +44,13 @@ void dali_textselectionpopup_cleanup(void)
 int UtcDaliToolkitTextSelectionPopupNewP(void)
 {
   ToolkitTestApplication application;
-  TextSelectionPopup textSelectionPopup;
+  TextSelectionPopup     textSelectionPopup;
 
-  DALI_TEST_CHECK( !textSelectionPopup );
+  DALI_TEST_CHECK(!textSelectionPopup);
 
-  textSelectionPopup = TextSelectionPopup::New( NULL );
+  textSelectionPopup = TextSelectionPopup::New(NULL);
 
-  DALI_TEST_CHECK( textSelectionPopup );
+  DALI_TEST_CHECK(textSelectionPopup);
   END_TEST;
 }
 
@@ -59,7 +58,7 @@ int UtcDaliToolkitTextSelectionPopupConstructorP(void)
 {
   TextSelectionPopup textSelectionPopup;
 
-  DALI_TEST_CHECK( !textSelectionPopup );
+  DALI_TEST_CHECK(!textSelectionPopup);
 
   END_TEST;
 }
@@ -67,24 +66,23 @@ int UtcDaliToolkitTextSelectionPopupConstructorP(void)
 int UtcDaliToolkitTextSelectionPopupCopyConstructorP(void)
 {
   ToolkitTestApplication application;
-  TextSelectionPopup textSelectionPopup;
+  TextSelectionPopup     textSelectionPopup;
 
-  textSelectionPopup = TextSelectionPopup::New( NULL );
-  TextSelectionPopup copy( textSelectionPopup );
+  textSelectionPopup = TextSelectionPopup::New(NULL);
+  TextSelectionPopup copy(textSelectionPopup);
 
-  DALI_TEST_CHECK( copy == textSelectionPopup );
+  DALI_TEST_CHECK(copy == textSelectionPopup);
 
   END_TEST;
 }
 
-
 int UtcDaliToolkitTextSelectionPopupDestructorP(void)
 {
   ToolkitTestApplication application;
-  TextSelectionPopup* textSelectionPopup = new TextSelectionPopup;
+  TextSelectionPopup*    textSelectionPopup = new TextSelectionPopup;
   delete textSelectionPopup;
 
-  DALI_TEST_CHECK( true );
+  DALI_TEST_CHECK(true);
 
   END_TEST;
 }
@@ -92,24 +90,24 @@ int UtcDaliToolkitTextSelectionPopupDestructorP(void)
 int UtcDaliToolkitTextSelectionPopupAssignmentOperatorP(void)
 {
   ToolkitTestApplication application;
-  TextSelectionPopup textSelectionPopup;
-  textSelectionPopup = TextSelectionPopup::New(  NULL );
+  TextSelectionPopup     textSelectionPopup;
+  textSelectionPopup = TextSelectionPopup::New(NULL);
   TextSelectionPopup copy;
   copy = textSelectionPopup;
 
-  DALI_TEST_CHECK( copy == textSelectionPopup );
+  DALI_TEST_CHECK(copy == textSelectionPopup);
   END_TEST;
 }
 
 int UtcDaliToolkitTextSelectionPopupDownCastP(void)
 {
   ToolkitTestApplication application;
-  TextSelectionPopup textSelectionPopup;
-  textSelectionPopup = TextSelectionPopup::New( NULL );
+  TextSelectionPopup     textSelectionPopup;
+  textSelectionPopup = TextSelectionPopup::New(NULL);
 
-  TextSelectionPopup cast = TextSelectionPopup::DownCast( textSelectionPopup );
+  TextSelectionPopup cast = TextSelectionPopup::DownCast(textSelectionPopup);
 
-  DALI_TEST_CHECK( cast );
+  DALI_TEST_CHECK(cast);
 
   END_TEST;
 }
@@ -117,25 +115,25 @@ int UtcDaliToolkitTextSelectionPopupDownCastP(void)
 int UtcDaliToolkitTextSelectionPopupBackgroundBorderP(void)
 {
   ToolkitTestApplication application;
-  TextSelectionPopup textSelectionPopup;
-  textSelectionPopup = TextSelectionPopup::New( NULL );
+  TextSelectionPopup     textSelectionPopup;
+  textSelectionPopup = TextSelectionPopup::New(NULL);
 
-  textSelectionPopup.SetProperty( TextSelectionPopup::Property::BACKGROUND_BORDER,
-                                  Property::Map().Add( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ) );
+  textSelectionPopup.SetProperty(TextSelectionPopup::Property::BACKGROUND_BORDER,
+                                 Property::Map().Add(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME));
 
-  Property::Value value = textSelectionPopup.GetProperty( TextSelectionPopup::Property::BACKGROUND_BORDER );
+  Property::Value value = textSelectionPopup.GetProperty(TextSelectionPopup::Property::BACKGROUND_BORDER);
 
   Property::Map map;
-  value.Get( map );
+  value.Get(map);
 
-  Property::Value* returnValue = map.Find( Dali::Toolkit::ImageVisual::Property::URL );
-  DALI_TEST_CHECK( NULL != returnValue );
+  Property::Value* returnValue = map.Find(Dali::Toolkit::ImageVisual::Property::URL);
+  DALI_TEST_CHECK(NULL != returnValue);
 
-  if( returnValue )
+  if(returnValue)
   {
     std::string url;
-    returnValue->Get( url );
-    DALI_TEST_EQUALS( TEST_IMAGE_FILE_NAME, url, TEST_LOCATION );
+    returnValue->Get(url);
+    DALI_TEST_EQUALS(TEST_IMAGE_FILE_NAME, url, TEST_LOCATION);
   }
 
   END_TEST;
@@ -150,27 +148,27 @@ int UtcDaliToolkitTextSelectionToolBarP(void)
 
   TextSelectionToolbar toolbar = TextSelectionToolbar::New();
 
-  toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::MAX_SIZE, Size( 100.0f, 60.0f) );
+  toolbar.SetProperty(Toolkit::TextSelectionToolbar::Property::MAX_SIZE, Size(100.0f, 60.0f));
 
   Toolkit::PushButton option = Toolkit::PushButton::New();
-  option.SetProperty( Dali::Actor::Property::NAME, "test-option" );
-  option.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-  toolbar.AddOption( option );
+  option.SetProperty(Dali::Actor::Property::NAME, "test-option");
+  option.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
+  toolbar.AddOption(option);
 
   Toolkit::Control divider = Toolkit::Control::New();
-  divider.SetProperty( Actor::Property::SIZE, Vector2( 2.0f, 0.0f ) );
-  divider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
-  toolbar.AddDivider( divider );
+  divider.SetProperty(Actor::Property::SIZE, Vector2(2.0f, 0.0f));
+  divider.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT);
+  toolbar.AddDivider(divider);
 
   Toolkit::PushButton option2 = Toolkit::PushButton::New();
-  option2.SetProperty( Dali::Actor::Property::NAME, "test-option-2" );
-  option2.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-  toolbar.AddOption( option2 );
+  option2.SetProperty(Dali::Actor::Property::NAME, "test-option-2");
+  option2.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
+  toolbar.AddOption(option2);
 
-  Size newSize =  Size(3.0f, 0.0f);
-  toolbar.ResizeDividers( newSize );
+  Size newSize = Size(3.0f, 0.0f);
+  toolbar.ResizeDividers(newSize);
 
-  DALI_TEST_CHECK( toolbar );
+  DALI_TEST_CHECK(toolbar);
   END_TEST;
 }
 
@@ -181,20 +179,20 @@ int UtcDaliToolkitTextSelectionToolBarScrollBarP(void)
 
   TextSelectionToolbar toolbar = TextSelectionToolbar::New();
 
-  toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::MAX_SIZE, Size( 100.0f, 60.0f) );
+  toolbar.SetProperty(Toolkit::TextSelectionToolbar::Property::MAX_SIZE, Size(100.0f, 60.0f));
 
   Toolkit::PushButton option = Toolkit::PushButton::New();
-  option.SetProperty( Dali::Actor::Property::NAME, "test-option" );
-  option.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-  toolbar.AddOption( option );
+  option.SetProperty(Dali::Actor::Property::NAME, "test-option");
+  option.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
+  toolbar.AddOption(option);
 
   // Add a scroll-bar
-  toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR, true );
+  toolbar.SetProperty(Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR, true);
 
-  bool enabled = toolbar.GetProperty<bool>( Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR );
-  DALI_TEST_CHECK( enabled );
+  bool enabled = toolbar.GetProperty<bool>(Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR);
+  DALI_TEST_CHECK(enabled);
 
-  DALI_TEST_CHECK( toolbar );
+  DALI_TEST_CHECK(toolbar);
   END_TEST;
 }
 
@@ -204,28 +202,28 @@ int UtcDaliToolkitTextSelectionToolBarScrollView(void)
   ToolkitTestApplication application;
 
   TextSelectionToolbar toolbar = TextSelectionToolbar::New();
-  DALI_TEST_CHECK( toolbar );
-  application.GetScene().Add( toolbar );
+  DALI_TEST_CHECK(toolbar);
+  application.GetScene().Add(toolbar);
 
   Property::Map map;
   map["overshootEffectColor"] = Color::RED;
-  map["overshootSize"] = Vector2(50.0f, 50.f);
-  toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::SCROLL_VIEW, map );
+  map["overshootSize"]        = Vector2(50.0f, 50.f);
+  toolbar.SetProperty(Toolkit::TextSelectionToolbar::Property::SCROLL_VIEW, map);
 
   application.SendNotification();
   application.Render();
 
   Actor actor = toolbar.FindChildByName("TextSelectionScrollView");
-  DALI_TEST_CHECK( actor );
+  DALI_TEST_CHECK(actor);
 
-  ScrollView scrollView = ScrollView::DownCast( actor );
-  DALI_TEST_CHECK( scrollView );
+  ScrollView scrollView = ScrollView::DownCast(actor);
+  DALI_TEST_CHECK(scrollView);
 
-  Vector4 color = scrollView.GetProperty<Vector4>( Toolkit::Scrollable::Property::OVERSHOOT_EFFECT_COLOR );
-  DALI_TEST_EQUALS( color, Color::RED, TEST_LOCATION );
+  Vector4 color = scrollView.GetProperty<Vector4>(Toolkit::Scrollable::Property::OVERSHOOT_EFFECT_COLOR);
+  DALI_TEST_EQUALS(color, Color::RED, TEST_LOCATION);
 
-  Vector2 size = scrollView.GetProperty<Vector2>( Toolkit::Scrollable::Property::OVERSHOOT_SIZE );
-  DALI_TEST_EQUALS( size, Vector2(50.0f, 50.f), TEST_LOCATION );
+  Vector2 size = scrollView.GetProperty<Vector2>(Toolkit::Scrollable::Property::OVERSHOOT_SIZE);
+  DALI_TEST_EQUALS(size, Vector2(50.0f, 50.f), TEST_LOCATION);
 
   END_TEST;
 }
@@ -233,7 +231,7 @@ int UtcDaliToolkitTextSelectionToolBarScrollView(void)
 int UtcDaliToolkitTextSelectionPopupIconProperties(void)
 {
   ToolkitTestApplication application;
-  TextSelectionPopup popup = TextSelectionPopup::New(nullptr);
+  TextSelectionPopup     popup = TextSelectionPopup::New(nullptr);
   popup.SetProperty(TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE, "POPUP_CLIPBOARD_BUTTON_ICON_IMAGE");
   popup.SetProperty(TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE, "POPUP_CUT_BUTTON_ICON_IMAGE");
   popup.SetProperty(TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE, "POPUP_COPY_BUTTON_ICON_IMAGE");
@@ -241,12 +239,12 @@ int UtcDaliToolkitTextSelectionPopupIconProperties(void)
   popup.SetProperty(TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE, "POPUP_SELECT_BUTTON_ICON_IMAGE");
   popup.SetProperty(TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE, "POPUP_SELECT_ALL_BUTTON_ICON_IMAGE");
 
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_CLIPBOARD_BUTTON_ICON_IMAGE", TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_CUT_BUTTON_ICON_IMAGE", TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_COPY_BUTTON_ICON_IMAGE", TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_PASTE_BUTTON_ICON_IMAGE", TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_SELECT_BUTTON_ICON_IMAGE", TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_SELECT_ALL_BUTTON_ICON_IMAGE", TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_CLIPBOARD_BUTTON_ICON_IMAGE", TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_CUT_BUTTON_ICON_IMAGE", TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_COPY_BUTTON_ICON_IMAGE", TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_PASTE_BUTTON_ICON_IMAGE", TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_SELECT_BUTTON_ICON_IMAGE", TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE).Get<std::string>(), "POPUP_SELECT_ALL_BUTTON_ICON_IMAGE", TEST_LOCATION);
 
   END_TEST;
 }
@@ -254,7 +252,7 @@ int UtcDaliToolkitTextSelectionPopupIconProperties(void)
 int UtcDaliToolkitTextSelectionPopupSizeProperties(void)
 {
   ToolkitTestApplication application;
-  TextSelectionPopup popup = TextSelectionPopup::New(nullptr);
+  TextSelectionPopup     popup = TextSelectionPopup::New(nullptr);
 
   const Vector2 popupMaxSize(200.0f, 300.0f);
   const Vector2 optionMaxSize(50.0f, 100.0f);
@@ -267,11 +265,11 @@ int UtcDaliToolkitTextSelectionPopupSizeProperties(void)
   popup.SetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE, optionDividerSize);
   popup.SetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING, optionDividerPadding);
 
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_MAX_SIZE).Get<Vector2>(), popupMaxSize, TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE).Get<Vector2>(), optionMaxSize, TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE).Get<Vector2>(), optionMinSize, TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE).Get<Vector2>(), optionDividerSize, TEST_LOCATION);
-  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING).Get<Vector4>(), optionDividerPadding, TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_MAX_SIZE).Get<Vector2>(), popupMaxSize, TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE).Get<Vector2>(), optionMaxSize, TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE).Get<Vector2>(), optionMinSize, TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE).Get<Vector2>(), optionDividerSize, TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING).Get<Vector4>(), optionDividerPadding, TEST_LOCATION);
 
   END_TEST;
 }