+
+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<int>(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;
+}
+
+