/*
- * 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 <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/images/image-factory.h>
#include <dali/internal/event/resources/resource-ticket.h>
+#include <dali/internal/common/image-attributes.h>
using namespace Dali;
using Internal::ResourceTicketPtr;
using Internal::ImageFactory;
using Internal::ImageFactoryCache::RequestPtr;
-
+using Internal::ImageAttributes;
namespace
{
{
// emulate load success
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource( bitmap );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height, width, height );
if( request )
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+ DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceSynchronouslyFunc ) );
application.GetPlatform().ResetTrace();
Image image2 = ResourceImage::New( gTestImageFilename );
application.SendNotification();
application.Render();
- // check resource is not loaded twice
- DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+ // Resource is loaded twice
+ DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceSynchronouslyFunc ) );
application.GetPlatform().ResetTrace();
Image image3 = ResourceImage::New( gTestImageFilename );
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+ DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceSynchronouslyFunc ) );
END_TEST;
}
// testing resource deletion when taken off stage
tet_infoline( "UtcDaliImageFactoryCachedRequest02 - Discard previously requested resource" );
- Image image = ResourceImage::New( gTestImageFilename, ResourceImage::IMMEDIATE, Image::UNUSED );
- ImageActor actor = ImageActor::New( image );
+ Image image = ResourceImage::New( gTestImageFilename );
+ Actor actor = CreateRenderableActor( image );
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+ DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceSynchronouslyFunc ) );
application.GetPlatform().ResetTrace();
// Add actor to stage
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+ DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceSynchronouslyFunc ) );
application.GetPlatform().ResetTrace();
// Resource is reloaded
DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
// request differs in scaled size - not default size
- ImageAttributes attr = ImageAttributes::New( 80, 160, Pixel::BGR8888 );
+ ImageAttributes attr = ImageAttributes::New( 80, 160);
req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
ResourceTicketPtr ticket4 = imageFactory.Load( *req2.Get() );
DALI_TEST_CHECK( req != req2 );
ImageFactory& imageFactory = Internal::ThreadLocalStorage::Get().GetImageFactory();
- ImageAttributes attr = ImageAttributes::New( 80, 160, Pixel::BGR8888 );
+ ImageAttributes attr = ImageAttributes::New( 80, 160 );
RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, &attr );
- ImageAttributes attr2 = ImageAttributes::New( 80, 160, Pixel::BGR8888 );
+ ImageAttributes attr2 = ImageAttributes::New( 80, 160 );
RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr2 );
DALI_TEST_EQUALS( req, req2, TEST_LOCATION );
END_TEST;
application.GetPlatform().ResetTrace();
ticket = imageFactory.Reload( *req.Get() );
+ DALI_TEST_CHECK( ticket );
application.SendNotification();
application.Render();
EmulateImageLoaded( application, 80, 80 );
ticket = imageFactory.Reload( *req.Get() );
+ DALI_TEST_CHECK( ticket );
application.SendNotification();
application.Render();