X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-DebugRendering.cpp;h=fe01738f63aa538a2b9583bd34fb0e827f194a96;hp=71641fbfae3668386d9ca50381cb6e2892bf5e90;hb=610495b8647d1a25c98bf0773ccc0dd6d1996263;hpb=7c1ca2d9ab3bc63f3dc164c4f5d4ea0d8bf5ba3e diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp old mode 100644 new mode 100755 index 71641fb..fe01738 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -39,7 +39,7 @@ const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif"; const std::string DEFAULT_FONT_DIR( "/resources/fonts" ); -void TestDebugVisual( Visual::Base& visual, Visual::Type actualType, Vector2 expectedNaturalSize ) +void TestDebugVisual( Integration::Scene scene, Visual::Base& visual, Visual::Type actualType, Vector2 expectedNaturalSize ) { { auto& impl = GetImplementation( visual ); @@ -61,7 +61,7 @@ void TestDebugVisual( Visual::Base& visual, Visual::Type actualType, Vector2 exp DummyControl actor = DummyControl::New(); DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual ); - Stage::GetCurrent().Add( actor ); + scene.Add( actor ); DALI_TEST_EQUALS( actor.GetRendererCount(), 1, TEST_LOCATION ); if( actor.GetRendererCount() > 0 ) @@ -97,7 +97,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap1.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE); Visual::Base colorVisual = factory.CreateVisual(propertyMap1); DALI_TEST_CHECK( colorVisual ); - TestDebugVisual( colorVisual, Visual::COLOR, Vector2::ZERO ); + TestDebugVisual( application.GetScene(), colorVisual, Visual::COLOR, Vector2::ZERO ); // Test that border visual is replaced with debug visual Property::Map propertyMap2; @@ -106,7 +106,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap2.Insert(BorderVisual::Property::SIZE, 2.f); Visual::Base borderVisual = factory.CreateVisual(propertyMap2); DALI_TEST_CHECK( borderVisual ); - TestDebugVisual( borderVisual, Visual::BORDER, Vector2::ZERO ); + TestDebugVisual( application.GetScene(), borderVisual, Visual::BORDER, Vector2::ZERO ); // Test that gradient visual is replaced with debug visual Property::Map propertyMap3; @@ -126,7 +126,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap3.Insert(GradientVisual::Property::STOP_COLOR, stopColors); Visual::Base gradientVisual = factory.CreateVisual(propertyMap3); DALI_TEST_CHECK( gradientVisual ); - TestDebugVisual( gradientVisual, Visual::GRADIENT, Vector2::ZERO ); + TestDebugVisual( application.GetScene(), gradientVisual, Visual::GRADIENT, Vector2::ZERO ); // Test that image visual is replaced with debug visual Property::Map propertyMap4; @@ -136,7 +136,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap4.Insert( ImageVisual::Property::DESIRED_HEIGHT, 100.f ); Visual::Base imageVisual = factory.CreateVisual( propertyMap4 ); DALI_TEST_CHECK( imageVisual ); - TestDebugVisual( imageVisual, Visual::IMAGE, Vector2( 50.f, 100.f ) ); + TestDebugVisual( application.GetScene(), imageVisual, Visual::IMAGE, Vector2( 50.f, 100.f ) ); // Test that SVG visual is replaced with debug visual // TEST_SVG_FILE: @@ -148,7 +148,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap5.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME ); Visual::Base svgVisual = factory.CreateVisual( propertyMap5 ); DALI_TEST_CHECK( svgVisual ); - TestDebugVisual( svgVisual, Visual::SVG, Vector2(100.f, 100.f) ); + TestDebugVisual( application.GetScene(), svgVisual, Visual::SVG, Vector2(100.f, 100.f) ); // Test that AnimatedImageVisual is replaced with debug visual // TEST_GIF_FILE: anim.gif @@ -158,7 +158,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap6.Insert( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ); Visual::Base animatedImageVisual = factory.CreateVisual( propertyMap6 ); DALI_TEST_CHECK( animatedImageVisual ); - TestDebugVisual( animatedImageVisual, Visual::ANIMATED_IMAGE, Vector2(50.f, 50.f) ); + TestDebugVisual( application.GetScene(), animatedImageVisual, Visual::ANIMATED_IMAGE, Vector2(50.f, 50.f) ); // Test that text visual is replaced with debug visual @@ -187,10 +187,10 @@ int UtcDaliDebugRenderingGetVisual1(void) Vector2 naturalSize; textVisual.GetNaturalSize( naturalSize ); - DALI_TEST_EQUALS( naturalSize, Vector2( 80.f, 20.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( naturalSize, Vector2( 82.f, 20.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); const float height = textVisual.GetHeightForWidth( 40.f ); - DALI_TEST_EQUALS( height, 40.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( height, 57.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); // Test that NPatchVisual is replaced with debug visual // TEST_NPATCH_FILE_NAME: image_01.9.jpg @@ -199,7 +199,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap8.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME ); Visual::Base nPatchVisual = factory.CreateVisual( propertyMap8 ); DALI_TEST_CHECK( nPatchVisual ); - TestDebugVisual( nPatchVisual, Visual::N_PATCH, Vector2::ZERO ); + TestDebugVisual( application.GetScene(), nPatchVisual, Visual::N_PATCH, Vector2::ZERO ); EnvironmentVariable::SetTestingEnvironmentVariable(false); END_TEST; @@ -221,7 +221,7 @@ int UtcDaliDebugRenderingGetVisual2(void) Visual::Base colorVisual = factory.CreateVisual( map); DALI_TEST_CHECK( colorVisual ); - TestDebugVisual( colorVisual, Visual::COLOR, Vector2::ZERO ); + TestDebugVisual( application.GetScene(), colorVisual, Visual::COLOR, Vector2::ZERO ); // Test that border visual is replaced with debug visual map.Clear(); @@ -230,18 +230,20 @@ int UtcDaliDebugRenderingGetVisual2(void) map[ BorderVisual::Property::SIZE ] = 2.f; Visual::Base borderVisual = factory.CreateVisual( map ); DALI_TEST_CHECK( borderVisual ); - TestDebugVisual( borderVisual, Visual::BORDER, Vector2::ZERO ); + TestDebugVisual( application.GetScene(), borderVisual, Visual::BORDER, Vector2::ZERO ); // Test that image visual is replaced with debug visual - Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME); - Visual::Base imageVisual = factory.CreateVisual( image ); + map.Clear(); + map[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE; + map[ ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME; + Visual::Base imageVisual = factory.CreateVisual( map ); DALI_TEST_CHECK( imageVisual ); - TestDebugVisual( imageVisual, Visual::IMAGE, Vector2::ZERO); + TestDebugVisual( application.GetScene(), imageVisual, Visual::IMAGE, Vector2(64.0f, 64.0f /* Broken Image Size */ )); // Test that n patch visual is replaced with debug visual Visual::Base nPatchVisual = factory.CreateVisual( TEST_NPATCH_FILE_NAME, ImageDimensions() ); DALI_TEST_CHECK( nPatchVisual ); - TestDebugVisual( nPatchVisual, Visual::N_PATCH, Vector2::ZERO ); + TestDebugVisual( application.GetScene(), nPatchVisual, Visual::N_PATCH, Vector2::ZERO ); EnvironmentVariable::SetTestingEnvironmentVariable(false); END_TEST; @@ -334,7 +336,7 @@ int UtcDaliDebugRenderingRenderText(void) try { Toolkit::TextLabel label = TextLabel::New( "Hello" ); - Stage::GetCurrent().Add( label ); + application.GetScene().Add( label ); DALI_TEST_CHECK( true ); } catch( ... ) {