#include <dali-toolkit-test-suite-utils.h>
#include <toolkit-event-thread-callback.h>
#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
#include <dali/devel-api/rendering/shader.h>
#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
controlRenderer.SetOnStage( actor );
DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
- DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == expectedSamplers );
application.SendNotification();
application.Render();
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
- propertyMap.Insert("gradientStartPosition", start);
- propertyMap.Insert("gradientEndPosition", end);
- propertyMap.Insert("gradientSpreadMethod", "repeat");
+ propertyMap.Insert("startPosition", start);
+ propertyMap.Insert("endPosition", end);
+ propertyMap.Insert("spreadMethod", "repeat");
Property::Array stopOffsets;
stopOffsets.PushBack( 0.2f );
stopOffsets.PushBack( 0.8f );
- propertyMap.Insert("gradientStopOffset", stopOffsets);
+ propertyMap.Insert("stopOffset", stopOffsets);
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("gradientStopColor", stopColors);
+ propertyMap.Insert("stopColor", stopColors);
ControlRenderer controlRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( controlRenderer );
Vector2 center(100.f, 100.f);
float radius = 100.f;
- propertyMap.Insert("gradientUnits", "userSpace");
- propertyMap.Insert("gradientCenter", center);
- propertyMap.Insert("gradientRadius", radius);
+ propertyMap.Insert("units", "userSpace");
+ propertyMap.Insert("center", center);
+ propertyMap.Insert("radius", radius);
Property::Array stopOffsets;
stopOffsets.PushBack( 0.0f );
stopOffsets.PushBack( 1.f );
- propertyMap.Insert("gradientStopOffset", stopOffsets);
+ propertyMap.Insert("stopOffset", stopOffsets);
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("gradientStopColor", stopColors);
+ propertyMap.Insert("stopColor", stopColors);
ControlRenderer controlRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( controlRenderer );
END_TEST;
}
+int UtcDaliRendererFactoryDefaultOffsetsGradientRenderer(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliRendererFactoryGetRadialGradientRenderer");
+
+ RendererFactory factory = RendererFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ Property::Map propertyMap;
+ propertyMap.Insert("rendererType", "gradient");
+
+ Vector2 start(-1.f, -1.f);
+ Vector2 end(1.f, 1.f);
+ propertyMap.Insert("startPosition", start);
+ propertyMap.Insert("endPosition", end);
+ propertyMap.Insert("spreadMethod", "repeat");
+
+ Property::Array stopColors;
+ stopColors.PushBack( Color::RED );
+ stopColors.PushBack( Color::GREEN );
+ propertyMap.Insert("stopColor", stopColors);
+
+ ControlRenderer controlRenderer = factory.GetControlRenderer(propertyMap);
+ DALI_TEST_CHECK( controlRenderer );
+
+ // A lookup texture is generated and pass to shader as sampler
+ Actor actor = Actor::New();
+ TestControlRendererRender( application, actor, controlRenderer, 1u );
+
+ controlRenderer.SetOffStage( actor );
+ DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+ END_TEST;
+}
+
int UtcDaliRendererFactoryGetImageRenderer1(void)
{
ToolkitTestApplication application;
const int width=512;
const int height=513;
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
ImageDimensions(width, height),
Integration::ResourcePointer( bitmap ) );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
controlRenderer.SetOffStage( actor );
DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(width, height),
Integration::ResourcePointer(bitmap) );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
END_TEST;
}
DALI_TEST_CHECK( controlRenderer );
Actor actor = Actor::New();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
ninePatchResource );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
}
propertyMap.Insert( "borderOnly", true );
DALI_TEST_CHECK( controlRenderer );
Actor actor = Actor::New();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
ninePatchResource );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
}
END_TEST;
DALI_TEST_CHECK( controlRenderer );
Actor actor = Actor::New();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
ninePatchResource );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
controlRenderer.SetOffStage( actor );
DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
DALI_TEST_CHECK( controlRenderer );
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
Actor actor = Actor::New();
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
ninePatchResource );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
controlRenderer.SetOffStage( actor );
DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
DALI_TEST_CHECK( controlRenderer );
Actor actor = Actor::New();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
ninePatchResource );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
END_TEST;
}
DALI_TEST_CHECK( controlRenderer );
Actor actor = Actor::New();
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
ninePatchResource );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
END_TEST;
}
//The testkit still has to load a bitmap for the broken renderer image
Integration::Bitmap* bitmap = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD);
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 100, 100, 100, 100 );
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(),
Integration::ResourcePointer(bitmap) );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
END_TEST;
}
//The testkit still has to load a bitmap for the broken renderer image
Integration::Bitmap* bitmap = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD);
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 100, 100, 100, 100 );
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
TestControlRendererRender( application, actor, controlRenderer, 1u,
ImageDimensions(),
Integration::ResourcePointer(bitmap) );
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
END_TEST;
}
ControlRenderer controlRenderer = factory.GetControlRenderer( TEST_SVG_FILE_NAME );
DALI_TEST_CHECK( controlRenderer );
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
Actor actor = Actor::New();
actor.SetSize( 200.f, 200.f );
Stage::GetCurrent().Add( actor );
application.Render();
DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
- // texture is not added until the rasterization completed.
- DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 0 );
EventThreadCallback* eventTrigger = EventThreadCallback::Get();
CallbackBase* callback = eventTrigger->GetCallback();
CallbackBase::Execute( *callback );
DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
- DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 1 );
// waiting for the resource uploading
application.SendNotification();
application.Render();
- TestGlAbstraction& gl = application.GetGlAbstraction();
- int textureUnit = -1;
- DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
END_TEST;
}
application.Render();
DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
- DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 1 );
// reset the renderer to renderer a svg image
factory.ResetRenderer( controlRenderer, actor, TEST_SVG_FILE_NAME, ImageDimensions( 100, 100 ) );
application.Render();
DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
- // texture is not added until the rasterization completed.
- DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 0 );
EventThreadCallback* eventTrigger = EventThreadCallback::Get();
CallbackBase* callback = eventTrigger->GetCallback();
eventTrigger->WaitingForTrigger( 1 );// waiting until the svg image is rasterized.
CallbackBase::Execute( *callback );
- DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 1 );
-
END_TEST;
}