/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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 <dali-toolkit/dali-toolkit.h>
#include <dali/devel-api/scripting/scripting.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali/public-api/rendering/renderer.h>
#include <test-native-image.h>
callStack.Reset();
callStack.Enable(true);
- ImageView imageView = ImageView::New( gImage_34_RGBA, ImageDimensions( 34, 34 ) );
+ Property::Map imageMap;
+
+ imageMap[ ImageVisual::Property::URL ] = gImage_34_RGBA;
+ imageMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 34;
+ imageMap[ ImageVisual::Property::DESIRED_WIDTH ] = 34;
+ imageMap[ DevelImageVisual::Property::ATLASING] = true;
+
+ ImageView imageView = ImageView::New();
+ imageView.SetProperty( ImageView::Property::IMAGE, imageMap );
// By default, Aysnc loading is used
// loading is not started if the actor is offStage
asyncLoadingMap[ "desiredHeight" ] = 34;
asyncLoadingMap[ "desiredWidth" ] = 34;
asyncLoadingMap[ "synchronousLoading" ] = false;
+ asyncLoadingMap[ "atlasing" ] = true;
ImageView imageView = ImageView::New();
imageView.SetProperty( ImageView::Property::IMAGE, asyncLoadingMap );
Property::Map syncLoadingMap;
syncLoadingMap[ ImageVisual::Property::SYNCHRONOUS_LOADING ] = true;
+ syncLoadingMap[ DevelImageVisual::Property::ATLASING ] = true;
// Sync loading, no atlasing for big size image
{
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 );
syncLoadingMap[ "desiredHeight" ] = 34;
syncLoadingMap[ "desiredWidth" ] = 34;
syncLoadingMap[ "synchronousLoading" ] = true;
+ syncLoadingMap[ "atlasing" ] = true;
imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
// loading is started even if the actor is offStage
END_TEST;
}
+bool gResourceReadySignalFired = false;
+
+void ResourceReadySignal( Control control )
+{
+ gResourceReadySignalFired = true;
+}
+
+int UtcDaliImageViewCheckResourceReady(void)
+{
+ ToolkitTestApplication application;
+
+ gResourceReadySignalFired = false;
+
+
+ int width = 100;
+ int height = 200;
+ Image image = CreateBufferImage( width, height, Vector4(1.f, 1.f, 1.f, 1.f) );
+
+ // Check ImageView with background and main image, to ensure both visuals are marked as loaded
+ ImageView imageView = ImageView::New( TEST_GIF_FILE_NAME );
+
+ imageView.SetBackgroundImage( image );
+
+ DALI_TEST_EQUALS( Toolkit::DevelControl::IsResourceReady( imageView ), false, TEST_LOCATION );
+
+ Toolkit::DevelControl::ResourceReadySignal( imageView ).Connect( &ResourceReadySignal);
+
+ Stage::GetCurrent().Add( imageView );
+
+ application.SendNotification();
+ application.Render(16);
+
+
+ DALI_TEST_EQUALS( Toolkit::DevelControl::IsResourceReady( imageView ), true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliImageViewSetImageOffstageN(void)
{
ToolkitTestApplication application;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream nextTextureParams;
- nextTextureParams << GL_TEXTURE_2D << ", " << 24;
+ nextTextureParams << GL_TEXTURE_EXTERNAL_OES << ", " << 24;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", nextTextureParams.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
width = 200;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream nativeImageParams;
- nativeImageParams << GL_TEXTURE_2D << ", " << 24;
+ nativeImageParams << GL_TEXTURE_EXTERNAL_OES << ", " << 24;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", nativeImageParams.str()) );