X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-VisualFactory.cpp;h=929825ce572e62e5a40b8299079247ea84dd8509;hp=33ed1eecfb60155b716a798f2cc782d0e593bc33;hb=ec1db95268e1cf8e8bd893027d45a19c64b32848;hpb=37aa8e50d140ee95be5f03fadbc269a0a239adde diff --git a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp index 33ed1ee..929825c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp @@ -771,9 +771,6 @@ int UtcDaliVisualFactoryGetNPatchVisual3(void) DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION ); - application.GetScene().Remove( actor ); - DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); - Vector2 naturalSize( 0.0f, 0.0f ); visual.GetNaturalSize( naturalSize ); DALI_TEST_EQUALS( naturalSize, Vector2( imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f ), TEST_LOCATION ); @@ -984,7 +981,80 @@ int UtcDaliVisualFactoryGetNPatchVisual7(void) END_TEST; } -int UtcDaliNPatchVisualAuxiliaryImage(void) +int UtcDaliVisualFactoryGetNPatchVisual8(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual8: Add 9-patch visual on stage, instantly remove it and add new 9-patch visual with same propertyMap" ); + + VisualFactory factory = VisualFactory::Get(); + DALI_TEST_CHECK( factory ); + + // Get actual size of test image + ImageDimensions imageSize = Dali::GetClosestImageSize( TEST_9_PATCH_FILE_NAME ); + + Property::Map propertyMap; + propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::N_PATCH ); + propertyMap.Insert( ImageVisual::Property::URL, TEST_9_PATCH_FILE_NAME ); + propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, false ); + { + Visual::Base visual = factory.CreateVisual( propertyMap ); + DALI_TEST_CHECK( visual ); + + Vector2 naturalSize( 0.0f, 0.0f ); + visual.GetNaturalSize( naturalSize ); + DALI_TEST_EQUALS( naturalSize, Vector2( imageSize.GetWidth(), imageSize.GetHeight() ), TEST_LOCATION ); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); + textureTrace.Enable(true); + + DummyControl actor = DummyControl::New(true); + + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); + DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + + application.GetScene().Add( actor ); + actor.Unparent(); + + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + visual = factory.CreateVisual( propertyMap ); + DALI_TEST_CHECK( visual ); + + visual.GetNaturalSize( naturalSize ); + DALI_TEST_EQUALS( naturalSize, Vector2( imageSize.GetWidth(), imageSize.GetHeight() ), TEST_LOCATION ); + + actor = DummyControl::New(true); + + DummyControlImpl& dummyImpl2 = static_cast(actor.GetImplementation()); + dummyImpl2.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); + DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + + application.GetScene().Add( actor ); + + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger(1 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + Renderer renderer = actor.GetRendererAt( 0 ); + auto textures = renderer.GetTextures(); + + DALI_TEST_EQUALS( textures.GetTextureCount(), 1, TEST_LOCATION ); + } + + END_TEST; +} + +int UtcDaliNPatchVisualAuxiliaryImage01(void) { ToolkitTestApplication application; tet_infoline( "NPatchVisual with aux image" ); @@ -1034,6 +1104,38 @@ int UtcDaliNPatchVisualAuxiliaryImage(void) END_TEST; } +int UtcDaliNPatchVisualAuxiliaryImage02(void) +{ + ToolkitTestApplication application; + tet_infoline( "Multiple NPatchVisual with aux image coincidentally" ); + + const Property::Value NPATCH_TEST{ + {ImageVisual::Property::URL, TEST_9_PATCH_FILE_NAME}, + {DevelImageVisual::Property::AUXILIARY_IMAGE, TEST_AUX_IMAGE}}; + + ImageView imageView1 = ImageView::New(); + imageView1[ImageView::Property::IMAGE] = NPATCH_TEST; + application.GetScene().Add( imageView1 ); + + ImageView imageView2 = ImageView::New(); + imageView2[ImageView::Property::IMAGE] = NPATCH_TEST; + application.GetScene().Add( imageView2 ); + + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + Renderer renderer1 = imageView1.GetRendererAt( 0 ); + auto textureSet1 = renderer1.GetTextures(); + + Renderer renderer2 = imageView2.GetRendererAt( 0 ); + auto textureSet2 = renderer2.GetTextures(); + DALI_TEST_EQUALS( textureSet1 != textureSet2, true, TEST_LOCATION ); + + END_TEST; +} + int UtcDaliVisualFactoryGetNPatchVisualN1(void) { @@ -1131,12 +1233,9 @@ int UtcDaliVisualFactoryGetSvgVisual(void) application.GetScene().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) ); + // Either application.SendNotification() or the trigger can now complete the task. application.SendNotification(); application.Render(); - - // renderer is not added to actor until the rasterization is completed. - DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); // renderer is added to actor @@ -1170,12 +1269,9 @@ int UtcDaliVisualFactoryGetSvgVisualLarge(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); application.GetScene().Add( actor ); + // Either application.SendNotification() or the trigger can now complete the task. application.SendNotification(); application.Render(); - - // renderer is not added to actor until the rasterization is completed. - DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); // renderer is added to actor @@ -1216,12 +1312,10 @@ int UtcDaliVisualFactoryGetSvgVisualAtlas(void) application.GetScene().Add( actor ); visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) ); + // Either application.SendNotification() or the trigger can now complete the task. + DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); application.SendNotification(); application.Render(); - - // renderer is not added to actor until the rasterization is completed. - DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); // renderer is added to actor