/*
- * 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.
return true;
}
+void PrepareResourceImage( ToolkitTestApplication& application, unsigned int imageWidth, unsigned int imageHeight, Pixel::Format pixelFormat )
+{
+ TestPlatformAbstraction& platform = application.GetPlatform();
+ platform.SetClosestImageSize(Vector2( imageWidth, imageHeight));
+
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
+ Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth, imageHeight, imageWidth, imageHeight );
+ unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
+ unsigned int initialColor = 0xFF;
+ memset( pixbuffer, initialColor, imageHeight*imageWidth*bytesPerPixel);
+
+ Integration::ResourcePointer resourcePtr(bitmap);
+ platform.SetSynchronouslyLoadedResource( resourcePtr );
+}
} //namespace
void dali_visual_startup(void)
DALI_TEST_EQUALS( naturalSize, Vector2::ZERO, TEST_LOCATION );
// image visual
+ PrepareResourceImage( application, 100u, 200u, Pixel::RGBA8888 );
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
Visual::Base imageVisual = factory.CreateVisual( image );
imageVisual.SetTransformAndSize(DefaultTransform(), controlSize );
DALI_TEST_CHECK( value->Get<bool>() == true );
// Get an image visual with an image handle, and test the default property values
+ PrepareResourceImage( application, 100u, 200u, Pixel::RGBA8888 );
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
imageVisual = factory.CreateVisual(image);
imageVisual.CreatePropertyMap( resultMap );
//Set a new transform
transform.Clear();
+ transform = DefaultTransform();
transform.Insert( DevelVisual::Transform::Property::OFFSET, Vector2(20.0f, 20.0f) );
transform.Insert( DevelVisual::Transform::Property::SIZE, Vector2(100.0f, 100.0f) );
transform.Insert( DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4(0.0f, 0.0f, 1.0f,1.0f) );
Renderer renderer = dummyControl.GetRendererAt(0u);
Property::Index index = renderer.GetPropertyIndex("size");
- tet_infoline( "Test that the TextVisual overrides anything set by developer" );
- DALI_TEST_EQUALS( renderer.GetProperty<Vector2>(index), Vector2( 1.0, 1.0 ), 0.001f, TEST_LOCATION );
+ tet_infoline( "Test that the TextVisual has NOT overridden what was set by developer" );
+ DALI_TEST_EQUALS( renderer.GetProperty<Vector2>(index), Vector2( 0.5f, 0.5f ), 0.001f, TEST_LOCATION );
END_TEST;
}