Merge "Add a TextEditor property to limit input to maximum characters" into devel...
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ItemView.cpp
index 8b011b8..1ba8d0b 100644 (file)
@@ -153,7 +153,7 @@ int UtcDaliItemViewNew(void)
   DALI_TEST_CHECK(view);
 
   //Additional check to ensure object is created by checking if it's registered
-  ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+  ObjectRegistry registry = application.GetCore().GetObjectRegistry();
   DALI_TEST_CHECK( registry );
 
   gObjectCreatedCallBackCalled = false;
@@ -166,6 +166,75 @@ int UtcDaliItemViewNew(void)
   END_TEST;
 }
 
+int UtcDaliItemViewCopyConstructor(void)
+{
+  ToolkitTestApplication application;
+
+  TestItemFactory factory;
+  ItemView itemView = ItemView::New( factory );
+  DALI_TEST_CHECK( itemView );
+
+  ItemView copy( itemView );
+  DALI_TEST_CHECK( copy );
+
+  END_TEST;
+}
+
+int UtcDaliItemViewCopyAssignment(void)
+{
+  ToolkitTestApplication application;
+
+  TestItemFactory factory;
+  ItemView itemView = ItemView::New( factory );
+  DALI_TEST_CHECK( itemView );
+
+  ItemView copy;
+  copy = itemView;
+  DALI_TEST_CHECK( copy );
+  DALI_TEST_EQUALS( itemView, copy, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliItemViewMoveConstructor(void)
+{
+  ToolkitTestApplication application;
+
+  TestItemFactory factory;
+  ItemView itemView = ItemView::New( factory );
+  DALI_TEST_EQUALS( 1, itemView.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+  itemView.SetProperty( Actor::Property::SENSITIVE, false );
+  DALI_TEST_CHECK( false == itemView.GetProperty< bool >( Actor::Property::SENSITIVE ) );
+
+  ItemView moved = std::move( itemView );
+  DALI_TEST_CHECK( moved );
+  DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+  DALI_TEST_CHECK( false == moved.GetProperty< bool >( Actor::Property::SENSITIVE ) );
+  DALI_TEST_CHECK( !itemView );
+
+  END_TEST;
+}
+
+int UtcDaliItemViewMoveAssignment(void)
+{
+  ToolkitTestApplication application;
+
+  TestItemFactory factory;
+  ItemView itemView = ItemView::New( factory );
+  DALI_TEST_EQUALS( 1, itemView.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+  itemView.SetProperty( Actor::Property::SENSITIVE, false );
+  DALI_TEST_CHECK( false == itemView.GetProperty< bool >( Actor::Property::SENSITIVE ) );
+
+  ItemView moved;
+  moved = std::move( itemView );
+  DALI_TEST_CHECK( moved );
+  DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+  DALI_TEST_CHECK( false == moved.GetProperty< bool >( Actor::Property::SENSITIVE ) );
+  DALI_TEST_CHECK( !itemView );
+
+  END_TEST;
+}
+
 int UtcDaliItemViewDownCast(void)
 {
   ToolkitTestApplication application;
@@ -289,7 +358,7 @@ int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void)
   DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
 
   // Activate the depth layout
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(1, stageSize, 0.5f);
 
   // Check the current active layout is the depth layout
@@ -326,7 +395,7 @@ int UtcDaliItemViewDeactivateCurrentLayout(void)
   DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
 
   // Activate the grid layout
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   // Check the current active layout is the grid layout
@@ -354,7 +423,7 @@ int UtcDaliItemViewGetItemAndGetItemId(void)
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   // Get the item given the item ID
@@ -379,7 +448,7 @@ int UtcDaliItemViewRemoveItem(void)
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   // Get the item given the item ID 2 and 3
@@ -434,7 +503,7 @@ int UtcDaliItemViewGetCurrentLayoutPosition(void)
   view.AddLayout(*depthLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.0f);
 
   // Check the current layout position for the 10th items is 9.0f
@@ -538,7 +607,7 @@ int UtcDaliItemViewScrollToItem(void)
   view.AddLayout(*layout);
   view.SetProperty( Actor::Property::SIZE, vec );
 
-  Stage::GetCurrent().Add(view);
+  application.GetScene().Add(view);
   layout->SetOrientation(ControlOrientation::Down);
   view.ActivateLayout(0, vec, 0.0f);
 
@@ -595,7 +664,7 @@ int UtcDaliItemViewScrollToItem(void)
     tet_result(TET_FAIL);
   }
 
-  Stage::GetCurrent().Remove(view);
+  application.GetScene().Remove(view);
   END_TEST;
 }
 
@@ -629,7 +698,7 @@ int UtcDaliItemViewInsertItemP(void)
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.0f);
 
   // Get the specified item where new item to be inserted before that
@@ -686,7 +755,7 @@ int UtcDaliItemViewInsertItemsP(void)
   view.AddLayout(*depthLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   unsigned int itemCount = view.GetChildCount();
@@ -757,7 +826,7 @@ int UtcDaliItemViewReplaceItemP(void)
   view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   Actor newActor = Actor::New();
@@ -783,7 +852,7 @@ int UtcDaliItemViewReplaceItemsP(void)
   view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   ItemContainer replaceList;
@@ -821,7 +890,7 @@ int UtcDaliItemViewGetItemsRangeP(void)
   view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   ItemRange itemRange(0, 0);
@@ -846,7 +915,7 @@ int UtcDaliItemViewSetItemsAnchorPointP(void)
   view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   Vector3 anchorPoint(10.0f, 10.0f, 0.0f);
@@ -871,7 +940,7 @@ int UtcDaliItemViewSetItemsParentOriginP(void)
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.5f);
 
   Vector3 parentOrigin(10.0f, 10.0f, 0.0f);
@@ -903,7 +972,7 @@ int UtcDaliItemViewLayoutActivatedSignalP(void)
   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
   view.AddLayout(*gridLayout);
 
-  Stage::GetCurrent().Add( view );
+  application.GetScene().Add( view );
 
   // Connect the layout activated signal
   view.LayoutActivatedSignal().Connect( &OnLayoutActivated );
@@ -915,7 +984,7 @@ int UtcDaliItemViewLayoutActivatedSignalP(void)
   application.Render();
 
   // Activate the grid layout so that the items will be created and added to ItemView
-  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  Vector3 stageSize(application.GetScene().GetSize());
   view.ActivateLayout(0, stageSize, 0.1f);
 
   // Wait for 0.1 second
@@ -1089,7 +1158,7 @@ int UtcDaliItemViewSetGetProperty(void)
 int UtcDaliItemViewOvershootVertical(void)
 {
   ToolkitTestApplication application;
-  Dali::Stage stage = Dali::Stage::GetCurrent();
+  Dali::Integration::Scene stage = application.GetScene();
 
   // Create the ItemView actor
   TestItemFactory factory;
@@ -1155,7 +1224,7 @@ int UtcDaliItemViewOvershootVertical(void)
 int UtcDaliItemViewOvershootHorizontal(void)
 {
   ToolkitTestApplication application;
-  Dali::Stage stage = Dali::Stage::GetCurrent();
+  Dali::Integration::Scene stage = application.GetScene();
 
   // Create the ItemView actor
   TestItemFactory factory;
@@ -1217,7 +1286,7 @@ int UtcDaliItemViewOvershootHorizontal(void)
 int UtcDaliItemEnableDisableRefresh(void)
 {
   ToolkitTestApplication application;
-  Dali::Stage stage = Dali::Stage::GetCurrent();
+  Dali::Integration::Scene stage = application.GetScene();
 
   // Create the ItemView actor
   TestItemFactory factory;