(Automated Tests) Get ObjectRegistry from Core rather than Stage
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ItemView.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 6af032c..6b5f743
@@ -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.
@@ -135,10 +135,7 @@ public: // From ItemFactory
   virtual Actor NewItem(unsigned int itemId)
   {
     // Create a renderable actor for this item
-    Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME );
-    Actor actor = CreateRenderableActor(image);
-
-    return actor;
+    return ImageView::New( TEST_IMAGE_FILE_NAME );
   }
 };
 
@@ -156,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;
@@ -292,7 +289,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
@@ -329,7 +326,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
@@ -357,7 +354,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
@@ -382,7 +379,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
@@ -437,7 +434,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
@@ -539,9 +536,9 @@ int UtcDaliItemViewScrollToItem(void)
 
   view.SetProperty( Dali::Actor::Property::NAME,"view actor");
   view.AddLayout(*layout);
-  view.SetSize(vec);
+  view.SetProperty( Actor::Property::SIZE, vec );
 
-  Stage::GetCurrent().Add(view);
+  application.GetScene().Add(view);
   layout->SetOrientation(ControlOrientation::Down);
   view.ActivateLayout(0, vec, 0.0f);
 
@@ -598,7 +595,7 @@ int UtcDaliItemViewScrollToItem(void)
     tet_result(TET_FAIL);
   }
 
-  Stage::GetCurrent().Remove(view);
+  application.GetScene().Remove(view);
   END_TEST;
 }
 
@@ -632,7 +629,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
@@ -689,7 +686,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();
@@ -760,7 +757,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();
@@ -786,7 +783,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;
@@ -824,7 +821,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);
@@ -849,7 +846,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);
@@ -874,7 +871,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);
@@ -906,7 +903,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 );
@@ -918,7 +915,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
@@ -1092,7 +1089,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;
@@ -1158,7 +1155,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;
@@ -1220,7 +1217,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;