Merge "TextController refactor." into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Visual.cpp
index 6de8e23..c329ccc 100644 (file)
@@ -188,6 +188,12 @@ int UtcDaliVisualSize(void)
   //  </svg>
   DALI_TEST_EQUALS( naturalSize, Vector2(100.f, 100.f), TEST_LOCATION );
 
+  // svg visual with a size
+  Visual::Base svgVisual2 = factory.CreateVisual( TEST_SVG_FILE_NAME, ImageDimensions(200, 200) );
+  DALI_TEST_EQUALS( svgVisual2.GetSize(), Vector2( 200.f, 200.f ), TEST_LOCATION );
+  svgVisual2.GetNaturalSize(naturalSize);
+  DALI_TEST_EQUALS( naturalSize, Vector2(100.f, 100.f), TEST_LOCATION ); // Natural size should still be 100, 100
+
   // Batch Image visual
   propertyMap.Clear();
   propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
@@ -308,6 +314,10 @@ int UtcDaliVisualGetPropertyMap1(void)
   DALI_TEST_CHECK( colorValue );
   DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::CYAN );
 
+  // Test the properties. TODO: to be completed.
+  colorVisual.SetProperty( ColorVisual::Property::MIX_COLOR, Color::RED );
+  Property::Value value = colorVisual.GetProperty( ColorVisual::Property::MIX_COLOR );
+
   END_TEST;
 }
 
@@ -358,6 +368,10 @@ int UtcDaliVisualGetPropertyMap2(void)
   DALI_TEST_CHECK( colorValue );
   DALI_TEST_CHECK( colorValue->Get<float>() == 10.f );
 
+  // Test the properties. TODO: to be completed.
+  borderVisual.SetProperty( BorderVisual::Property::COLOR, Color::RED );
+  Property::Value value = borderVisual.GetProperty( BorderVisual::Property::COLOR );
+
   END_TEST;
 }
 
@@ -425,6 +439,10 @@ int UtcDaliVisualGetPropertyMap3(void)
   DALI_TEST_EQUALS( colorArray->GetElementAt(0).Get<Vector4>(), Color::RED , Math::MACHINE_EPSILON_100, TEST_LOCATION );
   DALI_TEST_EQUALS( colorArray->GetElementAt(1).Get<Vector4>(), Color::GREEN , Math::MACHINE_EPSILON_100, TEST_LOCATION );
 
+  // Test the properties. TODO: to be completed.
+  gradientVisual.SetProperty( GradientVisual::Property::STOP_COLOR, Color::RED );
+  Property::Value gradientValue = gradientVisual.GetProperty( GradientVisual::Property::STOP_COLOR );
+
   END_TEST;
 }
 
@@ -609,6 +627,10 @@ int UtcDaliVisualGetPropertyMap5(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<bool>() == false );
 
+  // Test the properties. TODO: to be completed.
+  imageVisual.SetProperty( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+  Property::Value imageValue = imageVisual.GetProperty( ImageVisual::Property::URL );
+
   END_TEST;
 }
 
@@ -640,6 +662,10 @@ int UtcDaliVisualGetPropertyMap6(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<bool>() );
 
+  // Test the properties. TODO: to be completed.
+  nPatchVisual.SetProperty( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
+  Property::Value nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::URL );
+
   END_TEST;
 }
 
@@ -652,7 +678,7 @@ int UtcDaliVisualGetPropertyMap7(void)
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::URL,  TEST_SVG_FILE_NAME );
+  propertyMap.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME );
   Visual::Base svgVisual = factory.CreateVisual( propertyMap );
 
   Property::Map resultMap;
@@ -679,6 +705,10 @@ int UtcDaliVisualGetPropertyMap7(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<std::string>() == TEST_SVG_FILE_NAME );
 
+  // Test the properties. TODO: to be completed.
+  svgVisual.SetProperty( ImageVisual::Property::URL, TEST_SVG_FILE_NAME );
+  Property::Value svgValue = svgVisual.GetProperty( ImageVisual::Property::URL );
+
   END_TEST;
 }
 
@@ -727,6 +757,10 @@ int UtcDaliVisualGetPropertyMap8(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_EQUALS( value->Get<Vector3>(), Vector3( 5.0f, 10.0f, 15.0f), Math::MACHINE_EPSILON_100, TEST_LOCATION );
 
+  // Test the properties. TODO: to be completed.
+  meshVisual.SetProperty( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+  Property::Value meshValue = meshVisual.GetProperty( MeshVisual::Property::OBJECT_URL );
+
   END_TEST;
 }
 
@@ -814,6 +848,10 @@ int UtcDaliVisualGetPropertyMap9(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_EQUALS( value->Get<Vector3>(), Vector3( 5.0f, 10.0f, 15.0f), Math::MACHINE_EPSILON_100, TEST_LOCATION );
 
+  // Test the properties. TODO: to be completed.
+  primitiveVisual.SetProperty( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
+  Property::Value primitiveValue = primitiveVisual.GetProperty( PrimitiveVisual::Property::SHAPE );
+
   END_TEST;
 }
 
@@ -853,6 +891,10 @@ int UtcDaliVisualGetPropertyMapBatchImageVisual(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<int>() == 30 );
 
+  // Test the properties. TODO: to be completed.
+  batchImageVisual.SetProperty( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+  Property::Value primitiveValue = batchImageVisual.GetProperty( ImageVisual::Property::URL );
+
   END_TEST;
 }
 
@@ -1088,5 +1130,9 @@ int UtcDaliVisualWireframeVisual(void)
   Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<int>() == Visual::WIREFRAME );
+
+  // Test the properties. TODO: to be completed.
+  Property::Value primitiveValue = visual.GetProperty( Visual::Property::TYPE );
+
   END_TEST;
 }