X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-VisualFactory.cpp;h=bad210c1b077e33f166266cb0b1de72ee7398858;hb=d51cf112336be005eec7a543b5665bfb7480918c;hp=c7f4282da5ef0e539d1a6c5f406933f59f5c1d75;hpb=071b25e591f0fff83d85087e3963fbe6387b7551;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp index c7f4282..bad210c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "dummy-control.h" #include @@ -33,7 +34,7 @@ using namespace Dali::Toolkit; namespace { -typedef Toolkit::Internal::NPatchLoader::StretchRanges StretchRanges; +typedef Toolkit::NPatchUtility::StretchRanges StretchRanges; const char* TEST_9_PATCH_FILE_NAME = TEST_RESOURCE_DIR "/demo-tile-texture-focused.9.png"; const char* TEST_NPATCH_FILE_NAME = TEST_RESOURCE_DIR "/heartsframe.9.png"; @@ -72,7 +73,7 @@ void TestVisualRender( ToolkitTestApplication& application, DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.f, 200.f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); Stage::GetCurrent().Add( actor ); @@ -93,7 +94,7 @@ void TestVisualAsynchronousRender( ToolkitTestApplication& application, DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.f, 200.f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); Stage::GetCurrent().Add( actor ); @@ -258,7 +259,7 @@ int UtcDaliVisualFactoryGetBorderVisual1(void) DummyControl actor = DummyControl::New(true); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize(200.f, 200.f); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f)); @@ -306,7 +307,7 @@ int UtcDaliVisualFactoryGetBorderVisual2(void) DummyControl actor = DummyControl::New(true); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize(200.f, 200.f); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f)); @@ -831,18 +832,6 @@ int UtcDaliVisualFactoryGetNPatchVisual4(void) textureTrace.Reset(); - ResourceImage image = ResourceImage::New( TEST_9_PATCH_FILE_NAME ); - Visual::Base nPatchVisual = factory.CreateVisual( image ); - - DummyControl actor1 = DummyControl::New(true); - TestVisualRender( application, actor1, nPatchVisual ); - - DALI_TEST_EQUALS( textureTrace.CountMethod("BindTexture"), 0, TEST_LOCATION ); // The same texture should be used with the first visual. - - naturalSize = Vector2( 0.0f, 0.0f ); - nPatchVisual.GetNaturalSize( naturalSize ); - DALI_TEST_EQUALS( naturalSize, Vector2( imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f ), TEST_LOCATION ); - END_TEST; } @@ -975,7 +964,7 @@ int UtcDaliVisualFactoryGetNPatchVisual7(void) DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.f, 200.f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); Stage::GetCurrent().Add( actor ); @@ -1027,7 +1016,7 @@ int UtcDaliNPatchVisualAuxiliaryImage(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); dummyImpl.SetLayout( DummyControl::Property::TEST_VISUAL, transformMap ); dummy.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - dummy.SetParentOrigin(ParentOrigin::CENTER); + dummy.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); Stage::GetCurrent().Add(dummy); application.SendNotification(); @@ -1138,7 +1127,7 @@ int UtcDaliVisualFactoryGetSvgVisual(void) DummyControl actor = DummyControl::New(true); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.f, 200.f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) ); @@ -1223,7 +1212,7 @@ int UtcDaliVisualFactoryGetSvgVisualAtlas(void) DummyControl actor = DummyControl::New(true); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.f, 200.f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) ); @@ -1262,7 +1251,7 @@ void MeshVisualLoadsCorrectlyTest( Property::Map& propertyMap, ToolkitTestApplic DummyControl actor = DummyControl::New(true); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.f, 200.f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2( 200.f, 200.f ) ); @@ -1305,7 +1294,7 @@ void MeshVisualDoesNotLoadCorrectlyTest( Property::Map& propertyMap, ToolkitTest DummyControl actor = DummyControl::New(true); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.f, 200.f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2( 200.f, 200.f ) ); @@ -1612,7 +1601,7 @@ void TestPrimitiveVisualWithProperties( Property::Map& propertyMap, ToolkitTestA DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.f, 200.f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2( 200.f, 200.f ) ); @@ -1717,7 +1706,7 @@ int UtcDaliVisualFactoryGetPrimitiveVisual4(void) //Set up visual properties. Property::Map propertyMap; propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE ); - propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CONICAL_FRUSTRUM ); + propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CONICAL_FRUSTUM ); propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) ); propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 ); propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f ); @@ -2053,12 +2042,17 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual1(void) DummyControl actor = DummyControl::New(true); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.0f, 200.0f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); application.SendNotification(); application.Render(); + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + // renderer is added to actor DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); Renderer renderer = actor.GetRendererAt( 0u ); @@ -2072,14 +2066,23 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual1(void) timer.MockEmitSignal(); application.SendNotification(); application.Render(); + + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION ); textureTrace.Reset(); - // Force the timer used by the animatedImageVisual to tick, timer.MockEmitSignal(); application.SendNotification(); application.Render(); + + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION ); textureTrace.Reset(); @@ -2087,6 +2090,11 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual1(void) timer.MockEmitSignal(); application.SendNotification(); application.Render(); + + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION ); textureTrace.Reset(); @@ -2122,12 +2130,17 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual2(void) DummyControl actor = DummyControl::New(true); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual ); - actor.SetSize( 200.0f, 200.0f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); Stage::GetCurrent().Add( actor ); application.SendNotification(); application.Render(); + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );