Unparents internalRoot actor when gaussian-blur-view is deactived.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-GaussianBlurView.cpp
index f3f6f77..531b94c 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.
 #include <stdlib.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
 
 namespace
 {
-const char* TEST_IMAGE_FILE_NAME =  "gallery_image_01.jpg";
+const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
 } // namespace
 
 void utc_gaussian_blur_view_startup(void)
@@ -177,11 +178,14 @@ int UtcDaliGaussianBlurActivateDeactivate(void)
 
   RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
   DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
+  DALI_TEST_CHECK( 2u == view.GetChildCount() );
 
   view.Deactivate();
 
   RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList();
   DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );
+  DALI_TEST_CHECK( 1u == view.GetChildCount() );
+
   END_TEST;
 }
 
@@ -215,8 +219,12 @@ int UtcDaliGaussianBlurViewSetGetRenderTarget(void)
   Stage::GetCurrent().Add(view);
   view.Activate();
 
-  FrameBufferImage renderTarget = FrameBufferImage::New( 480.0f, 800.0f, Pixel::RGB888 );
-  view.SetUserImageAndOutputRenderTarget(ResourceImage::New(TEST_IMAGE_FILE_NAME), renderTarget);
+  PixelData pixels = Toolkit::SyncImageLoader::Load( TEST_IMAGE_FILE_NAME );
+  Texture texture = Texture::New( TextureType::TEXTURE_2D, pixels.GetPixelFormat(), pixels.GetWidth(), pixels.GetHeight() );
+  texture.Upload( pixels, 0, 0, 0, 0, pixels.GetWidth(), pixels.GetHeight() );
+
+  FrameBuffer renderTarget = FrameBuffer::New( 480, 800, FrameBuffer::Attachment::NONE );
+  view.SetUserImageAndOutputRenderTarget(texture, renderTarget);
   DALI_TEST_CHECK( view.GetBlurredRenderTarget() == renderTarget );
   END_TEST;
 }
@@ -248,7 +256,7 @@ int UtcDaliGaussianBlurViewActivateOnce(void)
 int UtcDaliGaussianBlurViewFinishedSignalN(void)
 {
   ToolkitTestApplication application;
-  tet_infoline("UtcDaliGaussianBlurViewSetGetRenderTarget");
+  tet_infoline("UtcDaliGaussianBlurViewFinishedSignalN");
 
   Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(5, 1.5f, Pixel::RGB888, 0.5f, 0.5f, true);
   DALI_TEST_CHECK( view );