[3.0] Remove/move experimental features
[platform/core/uifw/dali-core.git] / automated-tests / src / dali-internal / utc-Dali-Internal-ResourceClient.cpp
index f7adbb1..034b341 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -23,9 +23,8 @@
 #include <test-native-image.h>
 
 // Internal headers are allowed here
-#include <dali/public-api/shader-effects/shader-effect.h>
 #include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/update/resources/bitmap-metadata.h>
+#include <dali/internal/update/resources/texture-metadata.h>
 #include <dali/internal/update/resources/resource-manager.h>
 #include <dali/internal/update/manager/update-manager.h>
 #include <dali/internal/event/resources/resource-client.h>
@@ -55,15 +54,15 @@ public:
   {}
 
   int LoadFailedCalled() {
-    tet_printf("TicketObserver: LoadingFailed() called %d times", mLoadingFailedCalled);
+    tet_printf("TicketObserver: LoadingFailed() called %d times\n", mLoadingFailedCalled);
     return mLoadingFailedCalled;
   }
   int LoadSucceededCalled() {
-    tet_printf("TicketObserver: LoadingSucceeded()  called %d times", mLoadingSucceededCalled);
+    tet_printf("TicketObserver: LoadingSucceeded()  called %d times\n", mLoadingSucceededCalled);
     return mLoadingSucceededCalled;
   }
   int  UploadCalled() {
-    tet_printf("TicketObserver: Uploaded() called %d times", mUploadedCount);
+    tet_printf("TicketObserver: Uploaded() called %d times\n", mUploadedCount);
     return mUploadedCount;
   }
   void Reset() {
@@ -209,9 +208,10 @@ int UtcDaliInternalRequestResourceBitmapRequests01(void)
     DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetResourcesFunc ) );
 
     DALI_TEST_CHECK( resourceManager.IsResourceLoaded(req->GetId()) );
-    Internal::BitmapMetadata bitmapData = resourceManager.GetBitmapMetadata(req->GetId());
-    DALI_TEST_CHECK( bitmapData.GetWidth() == 80 );
-    DALI_TEST_CHECK( bitmapData.GetHeight() == 80 );
+    Internal::TextureMetadata* bitmapData = NULL;
+    DALI_TEST_CHECK( resourceManager.GetTextureMetadata(req->GetId(), bitmapData ) );
+    DALI_TEST_CHECK( bitmapData->GetWidth() == 80 );
+    DALI_TEST_CHECK( bitmapData->GetHeight() == 80 );
 
     DALI_TEST_EQUALS( imageTicket->GetWidth(), 0, TEST_LOCATION );
     DALI_TEST_EQUALS( imageTicket->GetHeight(), 0, TEST_LOCATION );
@@ -412,24 +412,25 @@ int UtcDaliInternalRequestReloadBitmapRequests01(void)
     DALI_TEST_CHECK( req->GetId() == ticket->GetId() );
     application.GetPlatform().SetResourceLoaded(id, Integration::ResourceBitmap, resourcePtr2);
 
-    application.Render(0);  // Process update messages / UpdateCache
+    application.Render(0 , TEST_LOCATION );  // Process update messages / UpdateCache
     DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetResourcesFunc ) );
 
     DALI_TEST_CHECK( resourceManager.IsResourceLoaded(id));
-    Internal::BitmapMetadata bitmapData = resourceManager.GetBitmapMetadata(id);
-    DALI_TEST_CHECK( bitmapData.GetWidth() == 120 );
-    DALI_TEST_CHECK( bitmapData.GetHeight() == 120 );
+    Internal::TextureMetadata* bitmapData = NULL;
+    DALI_TEST_CHECK( resourceManager.GetTextureMetadata(req->GetId(), bitmapData ) );
+    DALI_TEST_CHECK( bitmapData->GetWidth() == 120 );
+    DALI_TEST_CHECK( bitmapData->GetHeight() == 120 );
 
     // Ticket can't have been updated yet - it should still have old values
     DALI_TEST_EQUALS( imageTicket->GetWidth(), 80, TEST_LOCATION );
     DALI_TEST_EQUALS( imageTicket->GetHeight(), 80, TEST_LOCATION );
 
     application.SendNotification(); // Process event messages
-    application.Render(0);          // Process update messages / UpdateCache
+    application.Render(0, TEST_LOCATION ); // Process update messages / UpdateCache
     application.SendNotification(); // Process event messages
 
     DALI_TEST_EQUALS( testTicketObserver.LoadSucceededCalled(), 2, TEST_LOCATION );
-    DALI_TEST_EQUALS( testTicketObserver.UploadCalled(), 0, TEST_LOCATION );
+    DALI_TEST_EQUALS( testTicketObserver.UploadCalled(), 1, TEST_LOCATION );
     DALI_TEST_EQUALS( ticket->GetLoadingState(), ResourceLoadingSucceeded, TEST_LOCATION );
     DALI_TEST_EQUALS( imageTicket->GetWidth(), 120, TEST_LOCATION );
     DALI_TEST_EQUALS( imageTicket->GetHeight(), 120, TEST_LOCATION );
@@ -437,9 +438,8 @@ int UtcDaliInternalRequestReloadBitmapRequests01(void)
   } // Discard ticket
 
   application.SendNotification(); // Flush update queue (with ticket discarded message
-  application.Render(1);          // Process update messages
+  application.Render(1, TEST_LOCATION );          // Process update messages
   application.SendNotification(); // Send event notifications
-  application.Render(1);          // Process update messages
 
   // Resource should have been discarded.
   DALI_TEST_CHECK( ! application.GetPlatform().WasCalled(TestPlatformAbstraction::CancelLoadFunc ) );
@@ -447,7 +447,7 @@ int UtcDaliInternalRequestReloadBitmapRequests01(void)
 
   DALI_TEST_EQUALS( testTicketObserver.LoadSucceededCalled(), 2, TEST_LOCATION );
   DALI_TEST_EQUALS( testTicketObserver.LoadFailedCalled(), 0, TEST_LOCATION );
-  DALI_TEST_EQUALS( testTicketObserver.UploadCalled(), 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( testTicketObserver.UploadCalled(), 1, TEST_LOCATION );
   END_TEST;
 }
 
@@ -520,9 +520,10 @@ int UtcDaliInternalRequestReloadBitmapRequests02(void)
     application.Render(0);
     DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetResourcesFunc ) );
     DALI_TEST_CHECK( resourceManager.IsResourceLoaded(id));
-    Internal::BitmapMetadata bitmapData = resourceManager.GetBitmapMetadata(id);
-    DALI_TEST_CHECK( bitmapData.GetWidth() == 80 );
-    DALI_TEST_CHECK( bitmapData.GetHeight() == 80 );
+    Internal::TextureMetadata* bitmapData = NULL;
+    DALI_TEST_CHECK( resourceManager.GetTextureMetadata(req->GetId(), bitmapData ) );
+    DALI_TEST_CHECK( bitmapData->GetWidth() == 80 );
+    DALI_TEST_CHECK( bitmapData->GetHeight() == 80 );
 
     DALI_TEST_EQUALS( imageTicket->GetWidth(), 0, TEST_LOCATION );
     DALI_TEST_EQUALS( imageTicket->GetHeight(), 0, TEST_LOCATION );
@@ -554,9 +555,9 @@ int UtcDaliInternalRequestReloadBitmapRequests02(void)
     DALI_TEST_EQUALS( testTicketObserver.UploadCalled(), 0, TEST_LOCATION );
 
     DALI_TEST_CHECK( resourceManager.IsResourceLoaded(id));
-    bitmapData = resourceManager.GetBitmapMetadata(id);
-    DALI_TEST_CHECK( bitmapData.GetWidth() == 80 );
-    DALI_TEST_CHECK( bitmapData.GetHeight() == 80 );
+    DALI_TEST_CHECK( resourceManager.GetTextureMetadata(req->GetId(), bitmapData ) );
+    DALI_TEST_CHECK( bitmapData->GetWidth() == 80 );
+    DALI_TEST_CHECK( bitmapData->GetHeight() == 80 );
     DALI_TEST_EQUALS( imageTicket->GetWidth(), 80, TEST_LOCATION );
     DALI_TEST_EQUALS( imageTicket->GetHeight(), 80, TEST_LOCATION );
 
@@ -634,9 +635,10 @@ int UtcDaliInternalRequestReloadBitmapRequests03(void)
     DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetResourcesFunc ) );
 
     DALI_TEST_CHECK( resourceManager.IsResourceLoaded(id));
-    Internal::BitmapMetadata bitmapData = resourceManager.GetBitmapMetadata(id);
-    DALI_TEST_CHECK( bitmapData.GetWidth() == 80 );
-    DALI_TEST_CHECK( bitmapData.GetHeight() == 80 );
+    Internal::TextureMetadata* bitmapData = NULL;
+    DALI_TEST_CHECK( resourceManager.GetTextureMetadata(req->GetId(), bitmapData ) );
+    DALI_TEST_CHECK( bitmapData->GetWidth() == 80 );
+    DALI_TEST_CHECK( bitmapData->GetHeight() == 80 );
 
     DALI_TEST_EQUALS( imageTicket->GetWidth(), 0, TEST_LOCATION );
     DALI_TEST_EQUALS( imageTicket->GetHeight(), 0, TEST_LOCATION );
@@ -666,9 +668,9 @@ int UtcDaliInternalRequestReloadBitmapRequests03(void)
     application.Render(0);  // Process update messages / UpdateCache
 
     DALI_TEST_CHECK( resourceManager.IsResourceLoaded(id));
-    bitmapData = resourceManager.GetBitmapMetadata(id);
-    DALI_TEST_CHECK( bitmapData.GetWidth() == 120 );
-    DALI_TEST_CHECK( bitmapData.GetHeight() == 120 );
+    DALI_TEST_CHECK( resourceManager.GetTextureMetadata(req->GetId(), bitmapData ) );
+    DALI_TEST_CHECK( bitmapData->GetWidth() == 120 );
+    DALI_TEST_CHECK( bitmapData->GetHeight() == 120 );
     DALI_TEST_EQUALS( imageTicket->GetWidth(), 80, TEST_LOCATION );
     DALI_TEST_EQUALS( imageTicket->GetHeight(), 80, TEST_LOCATION );