Fixed interaction between scale dimensions and bevel percentage properties of primiti...
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-VisualFactory.cpp
index 79b2f69..37843da 100644 (file)
@@ -1679,6 +1679,186 @@ int UtcDaliVisualFactoryGetPrimitiveVisual8(void)
   END_TEST;
 }
 
+//Test if primitive shape loads correctly when told to use too many slices.
+int UtcDaliVisualFactoryGetPrimitiveVisual9(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual9:  Request primitive visual with above-cap slices." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::SLICES, Property::Value( 1000000 ) );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too few slices. (2 slices or less.)
+int UtcDaliVisualFactoryGetPrimitiveVisual10(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual10:  Request primitive visual with too few slices." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::SLICES, Property::Value( 2 ) );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too many stacks.
+int UtcDaliVisualFactoryGetPrimitiveVisual11(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual11:  Request primitive visual with too many stacks." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::STACKS, Property::Value( 1000000 ) );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too few stacks. (1 stack or less.)
+int UtcDaliVisualFactoryGetPrimitiveVisual12(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual12:  Request primitive visual with too few stacks." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::STACKS, Property::Value( 1 ) );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use invalid (zero or negative) dimensions.
+int UtcDaliVisualFactoryGetPrimitiveVisual13(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual13:  Request primitive visual with invalid scale dimensions." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::SCALE_DIMENSIONS, Vector3::ZERO );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too low a bevel percentage.
+int UtcDaliVisualFactoryGetPrimitiveVisual14(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual14:  Request primitive visual with too low a bevel percentage." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, Property::Value( -1.0f ) );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too high a bevel percentage.
+int UtcDaliVisualFactoryGetPrimitiveVisual15(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual15:  Request primitive visual with too high a bevel percentage." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, Property::Value( 2.0f ) );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too low a bevel smoothness.
+int UtcDaliVisualFactoryGetPrimitiveVisual16(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual16:  Request primitive visual with too low a bevel smoothness." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, Property::Value( -1.0f ) );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too high a bevel smoothness.
+int UtcDaliVisualFactoryGetPrimitiveVisual17(void)
+{
+  //Set up test application first, so everything else can be handled.
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual17:  Request primitive visual with too high a bevel smoothness." );
+
+  //Set up visual properties.
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+  propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+  propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, Property::Value( 2.0f ) );
+
+  //Test to see if shape loads correctly.
+  TestPrimitiveVisualWithProperties( propertyMap, application );
+
+  END_TEST;
+}
+
 //Test if primitive shape visual handles the case of not being passed a specific shape to use.
 int UtcDaliVisualFactoryGetPrimitiveVisualN1(void)
 {