// Different requests, incompatible resource, so two loads result:
int UtcDaliImageFactoryInCompatibleResource(void)
{
  TestApplication application;
  tet_infoline( "UtcDaliImageFactoryCompatibleResource02 - Two requests mapping to same resource." );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize(2048.0f, 2048.0f);
  application.GetPlatform().SetClosestImageSize(testSize);

  // request with default attributes ( size is 0,0 )
  RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // emulate load success
  EmulateImageLoaded( application, testSize.x, testSize.y );

  // Request substantially different size than actual image.
  // This will issue a second resource load as difference in sizes is greater than
  // the small fudge factor used in the ImageFactory cache.
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( testSize.x - 16, testSize.y - 16 );
  RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );

  DALI_TEST_CHECK( req != req2 ); // different requests
  DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // differnet resources
  END_TEST;
}
// Different requests, compatible resource
int UtcDaliImageFactoryCompatibleResource03(void)
{
  TestApplication application;
  tet_infoline( "UtcDaliImageFactoryCompatibleResource03 - Two requests mapping to same resource" );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize(80.0f, 80.0f);
  application.GetPlatform().SetClosestImageSize(testSize);

  // this time use defined attributes, nut just NULL
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( 120, 120 );

  // request with default attributes ( size is 0,0 )
  RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, &attr );
  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // emulate load success
  EmulateImageLoaded( application, 80, 80 );

  ImageAttributes attr2 = ImageAttributes::New();
  attr2.SetSize( 80, 80 );
  RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr2 );
  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );

  DALI_TEST_CHECK( req != req2 ); // different requests
  DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
  END_TEST;
}
// Different requests, compatible resource
int UtcDaliImageFactoryCompatibleResource02(void)
{
  TestApplication application;
  tet_infoline( "UtcDaliImageFactoryCompatibleResource02 - Two requests mapping to same resource." );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize( 2048.0f, 2048.0f );
  application.GetPlatform().SetClosestImageSize( testSize );

  // request with default attributes ( size is 0,0 )
  RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // emulate load success
  EmulateImageLoaded( application, testSize.x, testSize.y );

  // Request slightly bigger size than actual image.
  // This will load the same resource as the ImageFactory cache uses a small fudge factor in matching.
  // See UtcDaliImageFactoryReload06
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( testSize.x + 1, testSize.y + 1 );
  RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );

  DALI_TEST_CHECK( req != req2 ); // different requests
  DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
  END_TEST;
}
Ejemplo n.º 4
0
void ImageView::SetImageDistanceField(const std::string& filename)
{
  ImageAttributes attributes = Dali::ImageAttributes::NewDistanceField(1.0f, 1);
  const Vector3 size = Self().GetCurrentSize();

  attributes.SetSize( size.x, size.y );
  Image image = Image::NewDistanceField(filename, attributes);
  mImageActor.SetImage( image );

  DistanceFieldEffect effect = DistanceFieldEffect::New();
  Self().SetShaderEffect( effect );
}
Ejemplo n.º 5
0
int UtcDaliImageActorGetCurrentImageSize03(void)
{
  TestApplication application;
  tet_infoline("Positive test for Dali::ImageActor::GetCurrentImageSize - Test that using an image resource with a requested size sets the actor size with it's nearest size immediately rather than on load");

  Vector2 closestImageSize( 80, 45);

  application.GetPlatform().SetClosestImageSize(closestImageSize);

  ImageAttributes attrs;
  attrs.SetSize(40, 30);
  Image image = Image::New("image.jpg", attrs);
  ImageActor actor = ImageActor::New( image );
  Stage::GetCurrent().Add(actor);

  application.SendNotification(); // Flush update messages
  application.Render();           // Process resource request
  application.SendNotification(); // Flush update messages
  application.Render();           // Process resource request

  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );

  // Now complete the image load
  Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );

  Integration::ResourcePointer resourcePtr(bitmap); // reference it
  application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
  application.Render();           // Process LoadComplete
  application.SendNotification(); // Process event messages
  application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
  application.GetPlatform().ClearReadyResources(); //

  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );

  // Test that setting a size on the actor can be 'undone' with SetNaturalSize()
  Vector2 size(200.0f, 200.0f);
  actor.SetSize(size);

  // flush the queue and render once
  application.SendNotification();
  application.Render();
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), size, TEST_LOCATION );

  actor.SetToNaturalSize();
  application.SendNotification();
  application.Render();
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
  END_TEST;
}
// Initally two different requests map to same resource.
// After overwriting the file, they load different image resources.
int UtcDaliImageFactoryReload06(void)
{
  TestApplication application;
  tet_infoline( "UtcDaliImageFactoryReload06 - Two requests first mapping to same resource, then different resources." );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize(2048.0f, 2048.0f);
    application.GetPlatform().SetClosestImageSize( testSize );

  // request with default attributes ( size is 0,0 )
  RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // emulate load success
  EmulateImageLoaded( application, testSize.x, testSize.y );

  // Request bigger size than actual image.
  // This will load the same resource.
  // However if image size changes later on to eg. 512*512 (file is overwritten),
  // reissuing these two requests will load different resources.
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( testSize.x + 1, testSize.y + 1 );
  RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );

  DALI_TEST_CHECK( req != req2 ); // different requests
  DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource

  Vector2 newSize(512.0f, 512.0f);
  application.GetPlatform().SetClosestImageSize(newSize);

  // reload fixed size (192,192) request
  ticket2 = imageFactory.Reload( *req2.Get() );

  // emulate load success
  // note: this is the only way to emulate what size is loaded by platform abstraction
  EmulateImageLoaded( application, testSize.x + 1, testSize.y + 1 );

  // reload default size request
  ticket = imageFactory.Reload( *req.Get() );

  DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // different resources
  END_TEST;
}
Ejemplo n.º 7
0
void ImageView::SetImageBitmap(const std::string& filename, float min, float max)
{
  int minLevel = ceilf(logf(min) / logf(2.0f));
  int maxLevel = ceilf(logf(max) / logf(2.0f));

  ImageAttributes attributes;
  const Vector3 size = Self().GetCurrentSize();

  if(minLevel==maxLevel)
  { // Single image detail level, no need for any notifications.
    const float detail = powf(2.0f, maxLevel);
    attributes.SetSize( size.x * detail, size.y * detail );
    Image image = Image::New( filename, attributes);
    mImageActor.SetImage( image );
  }
  else
  { // Multi image detail level...
    for( int level = minLevel; level <= maxLevel; level++)
    {
      const float minDetail = powf(2.0f, level - 1);
      const float maxDetail = powf(2.0f, level);
      ImageRequest req(filename, size.x * maxDetail, size.y * maxDetail );

      if(level==minLevel)
      {
        AddImage(req, LessThanCondition(maxDetail) );
      }
      else if(level==maxLevel)
      {
        AddImage(req, GreaterThanCondition(minDetail) );
      }
      else
      {
        AddImage(req, InsideCondition(minDetail, maxDetail) );
      }
    }
  }
}
// Testing OnDemand + Reload
// Reload should have no effect if OnDemand Image is not loaded yet, as stated in the API documentation
int UtcDaliImageFactoryReload05(void)
{
  TestApplication application;

  tet_infoline( "UtcDaliImageFactoryReload05 - Reload OnDemand image" );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize(80.0f, 80.0f);
  application.GetPlatform().SetClosestImageSize(testSize);

  RequestPtr req;
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( 80, 80 );

  // this happens first when loading Image OnDemand
  req = imageFactory.RegisterRequest( gTestImageFilename, &attr );

  application.SendNotification();
  application.Render();

  ResourceTicketPtr ticket = imageFactory.Reload( *req.Get() );

  DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
  DALI_TEST_CHECK( !ticket );

  // this happens when Image is put on stage
  ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();

  DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
  DALI_TEST_CHECK( ticket );
  application.GetPlatform().ResetTrace();

  ticket = imageFactory.Reload( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // still loading, no new request
  DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );

  // emulate load success
  EmulateImageLoaded( application, 80, 80 );

  ticket = imageFactory.Reload( *req.Get() );

  application.SendNotification();
  application.Render();

  application.SendNotification();
  application.Render();


  DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
  END_TEST;
}
Ejemplo n.º 9
0
int UtcDaliImageActorNaturalPixelAreaSize02(void)
{
  TestApplication application;
  tet_infoline("Positive test for Dali::ImageActor::GetCurrentImageSize - check a new image doens't change actor size until load complete");

//If an image is loaded without setting size, then the actor gets the natural size of the image
//Setting the pixel area will change the actor size to match the pixel area
//Setting the actor size will not change pixel area, and will cause the partial image to stretch
//to the new size.
//Clearing the pixel area will not change actor size, and the actor will show the whole image.


  Vector2 closestImageSize( 80, 45);
  application.GetPlatform().SetClosestImageSize(closestImageSize);

  ImageAttributes attrs;
  attrs.SetSize(40, 30); // Request a really small size we won't get.
  Image image = Image::New("image.jpg", attrs);
  ImageActor actor = ImageActor::New( image );
  Stage::GetCurrent().Add(actor);

  application.SendNotification(); // Flush update messages
  application.Render();           // Process resource request

  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
  DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), closestImageSize, TEST_LOCATION );

  // Now complete the image load
  Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );

  Integration::ResourcePointer resourcePtr(bitmap); // reference it
  application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
  application.Render();           // Process LoadComplete
  application.SendNotification(); // Process event messages
  application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
  application.GetPlatform().ClearReadyResources(); //

  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
  DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), closestImageSize, TEST_LOCATION );

  // Set a pixel area on a naturally sized actor - expect the actor to take the
  // pixel area as size
  actor.SetPixelArea(ImageActor::PixelArea(0, 0, 30, 30));
  application.SendNotification(); // Process event messages
  application.Render();           // Process LoadComplete
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), Vector2(30, 30), TEST_LOCATION );
  DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(30, 30), TEST_LOCATION );

  // Clear the pixel area. Expect the whole image to be shown, changing actor size
  actor.ClearPixelArea();
  application.SendNotification(); // Process event messages
  application.Render();           // Process LoadComplete
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
  DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), closestImageSize, TEST_LOCATION );

  // Set a size. Expect the partial image to stretch to fill the new size
  actor.SetSize(100, 100);
  application.SendNotification(); // Process event messages
  application.Render();           // Process LoadComplete
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), Vector2(100, 100), TEST_LOCATION );
  DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );

  // Set a pixel area, don't expect size to change
  actor.SetPixelArea(ImageActor::PixelArea(0, 0, 40, 40));
  application.SendNotification(); // Process event messages
  application.Render();           // Process LoadComplete
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), Vector2(40, 40), TEST_LOCATION );
  DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );

  // Use natural size - expect actor to change to pixel area
  actor.SetToNaturalSize();
  application.SendNotification(); // Process event messages
  application.Render();           // Process LoadComplete
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), Vector2(40, 40), TEST_LOCATION );
  DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(40, 40), TEST_LOCATION );

  // Clearing pixel area should change actor size to image size
  actor.ClearPixelArea();
  application.SendNotification(); // Process event messages
  application.Render();           // Process LoadComplete
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
  DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), closestImageSize, TEST_LOCATION );
  END_TEST;
}
Ejemplo n.º 10
0
int UtcDaliImageActorGetCurrentImageSize05(void)
{
  TestApplication application;
  tet_infoline("Positive test for Dali::ImageActor::GetCurrentImageSize - check a new image doens't change actor size until load complete");

  Vector2 closestImageSize( 80, 45);
  application.GetPlatform().SetClosestImageSize(closestImageSize);

  ImageAttributes attrs;
  attrs.SetSize(40, 30); // Request a really small size we won't get.
  Image image = Image::New("image.jpg", attrs);
  ImageActor actor = ImageActor::New( image );
  Stage::GetCurrent().Add(actor);

  application.SendNotification(); // Flush update messages
  application.Render();           // Process resource request

  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );

  // Now complete the image load
  Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );

  Integration::ResourcePointer resourcePtr(bitmap); // reference it
  application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
  application.Render();           // Process LoadComplete
  application.SendNotification(); // Process event messages
  application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
  application.GetPlatform().ClearReadyResources(); //

  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );

  // Load a different image

  Vector2 image2ClosestSize = Vector2(240, 150);
  application.GetPlatform().SetClosestImageSize(image2ClosestSize);

  attrs.SetSize(100, 100);
  Image image2 = Image::New("image2.jpg", attrs);
  actor.SetImage(image2);

  application.SendNotification(); // Flush update messages
  application.Render();           // Process resource request
  application.SendNotification(); // Flush update messages
  application.Render();           // Process resource request

  // Ensure the actor size is kept
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );

  // Now complete the image load
  req = application.GetPlatform().GetRequest();
  Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
  bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );

  Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
  application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr2);
  application.Render();           // Process LoadComplete
  application.SendNotification(); // Process event messages
  application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
  application.GetPlatform().ClearReadyResources(); //

  application.SendNotification(); // Process event messages
  application.Render();           // Process LoadComplete

  // Ensure the actor size gets the new image's natural size
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), image2ClosestSize, TEST_LOCATION );
  END_TEST;
}
Ejemplo n.º 11
0
int UtcDaliScriptingCreatePropertyMapImage(void)
{
  TestApplication application;

  // Empty
  {
    Image image;
    Property::Map map;
    CreatePropertyMap( image, map );
    DALI_TEST_CHECK( map.empty() );
  }

  // Default
  {
    Image image = Image::New( "MY_PATH" );

    Property::Map map;
    CreatePropertyMap( image, map );
    DALI_TEST_CHECK( !map.empty() );

    Property::Value value( map );
    DALI_TEST_CHECK( value.HasKey( "type" ) );
    DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "Image", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "filename" ) );
    DALI_TEST_EQUALS( value.GetValue( "filename" ).Get< std::string >(), "MY_PATH", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "load-policy") );
    DALI_TEST_EQUALS( value.GetValue( "load-policy" ).Get< std::string >(), "IMMEDIATE", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "release-policy") );
    DALI_TEST_EQUALS( value.GetValue( "release-policy" ).Get< std::string >(), "NEVER", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "pixel-format") );
    DALI_TEST_EQUALS( value.GetValue( "pixel-format" ).Get< std::string >(), "RGBA8888", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "scaling-mode") );
    DALI_TEST_EQUALS( value.GetValue( "scaling-mode" ).Get< std::string >(), "SHRINK_TO_FIT", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "crop" ) );
    DALI_TEST_EQUALS( value.GetValue( "crop" ).Get< Vector4 >(), Vector4( 0.0f, 0.0f, 1.0f, 1.0f ), TEST_LOCATION );
    DALI_TEST_CHECK( !value.HasKey( "width" ) );
    DALI_TEST_CHECK( !value.HasKey( "height" ) );
  }

  // Change values
  {
    ImageAttributes attributes;
    attributes.SetPixelFormat( Pixel::A8 );
    attributes.SetScalingMode( ImageAttributes::FitWidth );
    attributes.SetCrop( Rect< float >( 0.5f, 0.2f, 0.2f, 0.4f ) );
    attributes.SetSize( 300, 400 );
    Image image = Image::New( "MY_PATH", attributes, Image::OnDemand, Image::Unused );

    Property::Map map;
    CreatePropertyMap( image, map );
    DALI_TEST_CHECK( !map.empty() );

    Property::Value value( map );
    DALI_TEST_CHECK( value.HasKey( "type" ) );
    DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "Image", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "filename" ) );
    DALI_TEST_EQUALS( value.GetValue( "filename" ).Get< std::string >(), "MY_PATH", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "load-policy") );
    DALI_TEST_EQUALS( value.GetValue( "load-policy" ).Get< std::string >(), "ON_DEMAND", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "release-policy") );
    DALI_TEST_EQUALS( value.GetValue( "release-policy" ).Get< std::string >(), "UNUSED", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "pixel-format") );
    DALI_TEST_EQUALS( value.GetValue( "pixel-format" ).Get< std::string >(), "A8", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "scaling-mode") );
    DALI_TEST_EQUALS( value.GetValue( "scaling-mode" ).Get< std::string >(), "FIT_WIDTH", TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "crop" ) );
    DALI_TEST_EQUALS( value.GetValue( "crop" ).Get< Vector4 >(), Vector4( 0.5f, 0.2f, 0.2f, 0.4f ), TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "width" ) );
    DALI_TEST_EQUALS( value.GetValue( "width" ).Get< int >(), 300, TEST_LOCATION );
    DALI_TEST_CHECK( value.HasKey( "height" ) );
    DALI_TEST_EQUALS( value.GetValue( "height" ).Get< int >(), 400, TEST_LOCATION );
  }

  // BitmapImage
  {
    Image image = BitmapImage::New( 200, 300, Pixel::RGBA8888 );
    Property::Map map;
    CreatePropertyMap( image, map );
    Property::Value value( map );
    DALI_TEST_CHECK( value.HasKey( "type" ) );
    DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "BitmapImage", TEST_LOCATION );
  }

  // FrameBufferImage
  {
    Image image = FrameBufferImage::New( 200, 300, Pixel::RGBA8888 );
    Property::Map map;
    CreatePropertyMap( image, map );
    Property::Value value( map );
    DALI_TEST_CHECK( value.HasKey( "type" ) );
    DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "FrameBufferImage", TEST_LOCATION );
  }
  END_TEST;
}