Changed image loaders to use new PixelBuffer class.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ImageView.cpp
index d1beb09..29b7a40 100644 (file)
@@ -18,7 +18,6 @@
 // Need to override adaptor classes for toolkit test harness, so include
 // test harness headers before dali headers.
 #include <dali-toolkit-test-suite-utils.h>
-#include <toolkit-bitmap-loader.h>
 #include <toolkit-event-thread-callback.h>
 
 #include <dali-toolkit/dali-toolkit.h>
@@ -29,6 +28,7 @@
 
 #include <test-native-image.h>
 #include <sstream>
+#include <unistd.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -427,20 +427,28 @@ int UtcDaliImageViewPixelArea(void)
 int UtcDaliImageViewAsyncLoadingWithoutAltasing(void)
 {
   ToolkitTestApplication application;
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  const std::vector<GLuint>& textures = gl.GetBoundTextures();
+  size_t numTextures = textures.size();
 
   // Async loading, no atlasing for big size image
   ImageView imageView = ImageView::New( gImage_600_RGB );
 
   // By default, Aysnc loading is used
   Stage::GetCurrent().Add( imageView );
+  imageView.SetSize(100, 100);
+  imageView.SetParentOrigin( ParentOrigin::CENTER );
+
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
   application.SendNotification();
   application.Render(16);
-  application.Render(16);
   application.SendNotification();
 
-  // BitmapLoader is not used
-  BitmapLoader loader = BitmapLoader::GetLatestCreated();
-  DALI_TEST_CHECK( !loader );
+  const std::vector<GLuint>& textures2 = gl.GetBoundTextures();
+  DALI_TEST_GREATER( textures2.size(), numTextures, TEST_LOCATION );
+
+
 
   END_TEST;
 }
@@ -547,35 +555,22 @@ int UtcDaliImageViewSyncLoading(void)
     // Sync loading is used
     syncLoadingMap[ ImageVisual::Property::URL ] = gImage_600_RGB;
     imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
-
-
-    // BitmapLoader is used, and the loading is started immediately even the actor is not on stage.
-    BitmapLoader loader = BitmapLoader::GetLatestCreated();
-    DALI_TEST_CHECK( loader );
   }
 
   // Sync loading, automatic atlasing for small size image
   {
-    BitmapLoader::ResetLatestCreated();
     TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
     callStack.Reset();
     callStack.Enable(true);
 
     ImageView imageView = ImageView::New( );
+
     // Sync loading is used
     syncLoadingMap[ ImageVisual::Property::URL ] = gImage_34_RGBA;
     syncLoadingMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 34;
     syncLoadingMap[ ImageVisual::Property::DESIRED_WIDTH ] = 34;
     imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
 
-    // loading is started even if the actor is offStage
-    BitmapLoader loader = BitmapLoader::GetLatestCreated();
-    DALI_TEST_CHECK( loader );
-
-    loader.WaitForLoading();
-
-    DALI_TEST_CHECK( loader.IsLoaded() );
-
     Stage::GetCurrent().Add( imageView );
     application.SendNotification();
     application.Render(16);
@@ -598,7 +593,6 @@ int UtcDaliImageViewSyncLoading02(void)
 
   // Sync loading, automatic atlasing for small size image
   {
-    BitmapLoader::ResetLatestCreated();
     TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
     callStack.Reset();
     callStack.Enable(true);
@@ -614,14 +608,6 @@ int UtcDaliImageViewSyncLoading02(void)
     syncLoadingMap[ "atlasing" ] = true;
     imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
 
-    // loading is started even if the actor is offStage
-    BitmapLoader loader = BitmapLoader::GetLatestCreated();
-    DALI_TEST_CHECK( loader );
-
-    loader.WaitForLoading();
-
-    DALI_TEST_CHECK( loader.IsLoaded() );
-
     Stage::GetCurrent().Add( imageView );
     application.SendNotification();
     application.Render(16);