X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-DebugRendering.cpp;h=9b733f206500a3298a9e21c80db43777deb16eea;hb=d52cfe949a764d4ab0584b99d1322f06c8acd92f;hp=8184dd7583541d98d8ed6f9c0cdc93c9e18fc4ad;hpb=4a7fc560a1be7c5226481391c1d4517b29c7f2c6;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp index 8184dd7..9b733f2 100755 --- 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) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -257,6 +257,73 @@ int UtcDaliDebugRenderingGetVisual2(void) END_TEST; } + +int UtcDaliDebugRenderingGetVisual3(void) +{ + EnvironmentVariable::SetTestingEnvironmentVariable( true ); + ToolkitTestApplication application; + tet_infoline( "UtcDaliDebugRenderingGetVisual3: Request visual with various parameters" ); + + VisualFactory factory = VisualFactory::Get(); + DALI_TEST_CHECK( factory ); + + // Test that image visual is replaced with debug visual + Dali::Property::Map map; + 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( application.GetScene(), imageVisual, Visual::IMAGE, Vector2(64.0f, 64.0f /* Broken Image Size */ )); + + // Test that image visual with null string don't make visual + map.Clear(); + map[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE; + map[ ImageVisual::Property::URL ] = ""; + Visual::Base emptyVisual = factory.CreateVisual( map ); + DALI_TEST_CHECK( emptyVisual ); + TestDebugVisual( application.GetScene(), emptyVisual, Visual::WIREFRAME, Vector2::ZERO); + + tet_infoline( "Check that GetVisualObject returns the actual WireframeVisual" ); + Toolkit::Internal::Visual::Base& visualImpl = GetImplementation( emptyVisual ).GetVisualObject(); + DALI_TEST_CHECK( dynamic_cast< Toolkit::Internal::WireframeVisual* >( &visualImpl ) ); + + tet_infoline( "Compare the returned emptyVisual with the visual implementation, should be the same" ); + DALI_TEST_CHECK( emptyVisual.GetObjectPtr() == &visualImpl ); + + // Test that image view with empty property map don't make visual even DebugRendering is enabled. + map.Clear(); + ImageView imageView1 = ImageView::New(); + imageView1.SetProperty(Control::Property::BACKGROUND, map); + imageView1.SetProperty(ImageView::Property::IMAGE, map); + + // Test that image view with empty property value don't make visual even DebugRendering is enabled. + Property::Value emptyValue; + ImageView imageView2 = ImageView::New(); + imageView2.SetProperty(Control::Property::BACKGROUND, emptyValue); + imageView2.SetProperty(ImageView::Property::IMAGE, emptyValue); + + // Test that image view with invalid property value don't make visual even DebugRendering is enabled. + Property::Value invalidValue(static_cast(3)); + ImageView imageView3 = ImageView::New(); + imageView3.SetProperty(Control::Property::BACKGROUND, invalidValue); + imageView3.SetProperty(ImageView::Property::IMAGE, invalidValue); + + application.GetScene().Add(imageView1); + application.GetScene().Add(imageView2); + application.GetScene().Add(imageView3); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( imageView1.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( imageView2.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( imageView3.GetRendererCount(), 0u, TEST_LOCATION ); + + EnvironmentVariable::SetTestingEnvironmentVariable(false); + END_TEST; +} + + int UtcDaliDebugRenderingGetVisualObject01(void) { EnvironmentVariable::SetTestingEnvironmentVariable( true ); @@ -281,6 +348,7 @@ int UtcDaliDebugRenderingGetVisualObject01(void) tet_infoline( "Compare the returned TextVisual with the visual implementation, should differ" ); DALI_TEST_CHECK( textVisual.GetObjectPtr() != &visualImpl ); + EnvironmentVariable::SetTestingEnvironmentVariable( false ); END_TEST; }