X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Scripting.cpp;h=3d543fa3d1a9c81afed4cdc792f5d51473214643;hb=38d5ea14619ce0cfa0b21edbfc3900b97403e4ff;hp=2ae4abf2073e1380a5b38d5aedcf4b87993b5454;hpb=653bc983fc6fdf81d4f90b12f53fde296f820e96;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-Scripting.cpp b/automated-tests/src/dali/utc-Dali-Scripting.cpp index 2ae4abf..3d543fa 100644 --- a/automated-tests/src/dali/utc-Dali-Scripting.cpp +++ b/automated-tests/src/dali/utc-Dali-Scripting.cpp @@ -15,35 +15,32 @@ * */ -#include - -#include -#include -#include #include +#include +#include +#include + +#include using namespace Dali; using namespace Dali::Scripting; namespace { - const StringEnum COLOR_MODE_VALUES[] = -{ - { "USE_OWN_COLOR", USE_OWN_COLOR }, - { "USE_PARENT_COLOR", USE_PARENT_COLOR }, - { "USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR }, - { "USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA }, + { + {"USE_OWN_COLOR", USE_OWN_COLOR}, + {"USE_PARENT_COLOR", USE_PARENT_COLOR}, + {"USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR}, + {"USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA}, }; -const unsigned int COLOR_MODE_VALUES_COUNT = sizeof( COLOR_MODE_VALUES ) / sizeof( COLOR_MODE_VALUES[0] ); +const unsigned int COLOR_MODE_VALUES_COUNT = sizeof(COLOR_MODE_VALUES) / sizeof(COLOR_MODE_VALUES[0]); const StringEnum DRAW_MODE_VALUES[] = -{ - { "NORMAL", DrawMode::NORMAL }, - { "OVERLAY_2D", DrawMode::OVERLAY_2D } -}; -const unsigned int DRAW_MODE_VALUES_COUNT = sizeof( DRAW_MODE_VALUES ) / sizeof( DRAW_MODE_VALUES[0] ); - + { + {"NORMAL", DrawMode::NORMAL}, + {"OVERLAY_2D", DrawMode::OVERLAY_2D}}; +const unsigned int DRAW_MODE_VALUES_COUNT = sizeof(DRAW_MODE_VALUES) / sizeof(DRAW_MODE_VALUES[0]); //////////////////////////////////////////////////////////////////////////////// // Helpers for string to enum comparisons for Image and Image loading parameters @@ -52,24 +49,24 @@ const unsigned int DRAW_MODE_VALUES_COUNT = sizeof( DRAW_MODE_VALUES ) / sizeof( /** * Template to check enumerations of type T, with a class of type X */ -template< typename T, typename X > +template void TestEnumStrings( - Property::Map& map, // The map used to create instance of type X - const char * const keyName, // the name of the key to iterate through - const StringEnum* values, // An array of string values - unsigned int num, // Number of items in the array - T ( X::*method )() const, // The member method of X to call to get the enum - X ( *creator ) ( const Property::Value& ) // The method which creates an instance of type X + Property::Map& map, // The map used to create instance of type X + const char* const keyName, // the name of the key to iterate through + const StringEnum* values, // An array of string values + unsigned int num, // Number of items in the array + T (X::*method)() const, // The member method of X to call to get the enum + X (*creator)(const Property::Value&) // The method which creates an instance of type X ) { // get the key reference so we can change its value - Property::Value* value = map.Find( keyName ); - for ( unsigned int i = 0; i < num; ++i ) + Property::Value* value = map.Find(keyName); + for(unsigned int i = 0; i < num; ++i) { *value = values[i].string; - tet_printf("Checking: %s: %s\n", keyName, values[i].string ); - X instance = creator( map ); - DALI_TEST_EQUALS( values[i].value, (int)( instance.*method )(), TEST_LOCATION ); + tet_printf("Checking: %s: %s\n", keyName, values[i].string); + X instance = creator(map); + DALI_TEST_EQUALS(values[i].value, (int)(instance.*method)(), TEST_LOCATION); } } @@ -80,56 +77,58 @@ void TestEnumStrings( /** * Template to check enumerations of type T */ -template< typename T > +template void TestEnumStrings( - const char * const keyName, // The name of the key to check - TestApplication& application, // Reference to the application class - const StringEnum* values, // An array of string values - unsigned int num, // Number of items in the array - void ( Actor::*method )( T ) // The Actor member method to set the enumeration + const char* const keyName, // The name of the key to check + TestApplication& application, // Reference to the application class + const StringEnum* values, // An array of string values + unsigned int num, // Number of items in the array + void (Actor::*method)(T) // The Actor member method to set the enumeration ) { - for ( unsigned int i = 0; i < num; ++i ) + for(unsigned int i = 0; i < num; ++i) { - tet_printf("Checking: %s: %s\n", keyName, values[i].string ); + tet_printf("Checking: %s: %s\n", keyName, values[i].string); Actor actor = Actor::New(); - (actor.*method)( ( T ) values[i].value ); + (actor.*method)((T)values[i].value); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); Property::Map map; - CreatePropertyMap( actor, map ); + CreatePropertyMap(actor, map); - DALI_TEST_CHECK( 0 < map.Count() ); - DALI_TEST_CHECK( NULL != map.Find( keyName ) ); - DALI_TEST_EQUALS( map.Find( keyName )->Get< std::string >(), values[i].string, TEST_LOCATION ); + DALI_TEST_CHECK(0 < map.Count()); + DALI_TEST_CHECK(NULL != map.Find(keyName)); + DALI_TEST_EQUALS(map.Find(keyName)->Get(), values[i].string, TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); } } ////////////////////////////////////////////////////////////////////////////// - -} // anon namespace +} // namespace int UtcDaliValueFromEnum(void) { - enum class T { - None, V1 = 1, V2 = 2 + enum class T + { + None, + V1 = 1, + V2 = 2 }; Property::Value v1 = T::V1; Property::Value v2 = T::V2; T t = T::None; - DALI_TEST_CHECK( v1.Get() == T::V1 ); - DALI_TEST_CHECK( v2.Get() == T::V2 ); - DALI_TEST_CHECK( v1.Get(t) && t == T::V1 ); - DALI_TEST_CHECK( v2.Get(t) && t == T::V2 ); + DALI_TEST_CHECK(v1.Get() == T::V1); + DALI_TEST_CHECK(v2.Get() == T::V2); + DALI_TEST_CHECK(v1.Get(t) && t == T::V1); + DALI_TEST_CHECK(v2.Get(t) && t == T::V2); END_TEST; } @@ -140,30 +139,30 @@ int UtcDaliScriptingNewActorNegative(void) // Empty map { - Actor handle = NewActor( Property::Map() ); - DALI_TEST_CHECK( !handle ); + Actor handle = NewActor(Property::Map()); + DALI_TEST_CHECK(!handle); } // Map with only properties { Property::Map map; - map[ "parentOrigin" ] = ParentOrigin::TOP_CENTER; - map[ "anchorPoint" ] = AnchorPoint::TOP_CENTER; - Actor handle = NewActor( map ); - DALI_TEST_CHECK( !handle ); + map["parentOrigin"] = ParentOrigin::TOP_CENTER; + map["anchorPoint"] = AnchorPoint::TOP_CENTER; + Actor handle = NewActor(map); + DALI_TEST_CHECK(!handle); } // Add some signals to the map, we should have no signal connections as its not yet supported { Property::Map map; - map[ "type" ] = "Actor"; - map[ "signals" ] = Property::MAP; - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); - DALI_TEST_CHECK( !handle.WheelEventSignal().GetConnectionCount() ); - DALI_TEST_CHECK( !handle.OffSceneSignal().GetConnectionCount() ); - DALI_TEST_CHECK( !handle.OnSceneSignal().GetConnectionCount() ); - DALI_TEST_CHECK( !handle.TouchedSignal().GetConnectionCount() ); + map["type"] = "Actor"; + map["signals"] = Property::MAP; + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); + DALI_TEST_CHECK(!handle.WheelEventSignal().GetConnectionCount()); + DALI_TEST_CHECK(!handle.OffSceneSignal().GetConnectionCount()); + DALI_TEST_CHECK(!handle.OnSceneSignal().GetConnectionCount()); + DALI_TEST_CHECK(!handle.TouchedSignal().GetConnectionCount()); } END_TEST; } @@ -173,77 +172,77 @@ int UtcDaliScriptingNewActorProperties(void) TestApplication application; Property::Map map; - map[ "type" ] = "Actor"; - map[ "size" ] = Vector3::ONE; - map[ "position" ] = Vector3::XAXIS; - map[ "scale" ] = Vector3::ONE; - map[ "visible" ] = false; - map[ "color" ] = Color::MAGENTA; - map[ "name" ] = "MyActor"; - map[ "colorMode" ] = "USE_PARENT_COLOR"; - map[ "sensitive" ] = false; - map[ "leaveRequired" ] = true; - map[ "drawMode" ] = "OVERLAY_2D"; - map[ "inheritOrientation" ] = false; - map[ "inheritScale" ] = false; + map["type"] = "Actor"; + map["size"] = Vector3::ONE; + map["position"] = Vector3::XAXIS; + map["scale"] = Vector3::ONE; + map["visible"] = false; + map["color"] = Color::MAGENTA; + map["name"] = "MyActor"; + map["colorMode"] = "USE_PARENT_COLOR"; + map["sensitive"] = false; + map["leaveRequired"] = true; + map["drawMode"] = "OVERLAY_2D"; + map["inheritOrientation"] = false; + map["inheritScale"] = false; // Default properties { - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); - application.GetScene().Add( handle ); + application.GetScene().Add(handle); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::XAXIS, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::MAGENTA, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< std::string >( Actor::Property::NAME ), "MyActor", TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_PARENT_COLOR, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::SENSITIVE ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::INHERIT_ORIENTATION ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), false, TEST_LOCATION ); - - application.GetScene().Remove( handle ); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::SIZE), Vector3::ONE, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::POSITION), Vector3::XAXIS, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::COLOR), Color::MAGENTA, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::NAME), "MyActor", TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::SENSITIVE), false, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::LEAVE_REQUIRED), true, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION); + + application.GetScene().Remove(handle); } // Check Anchor point and parent origin vector3s - map[ "parentOrigin" ] = ParentOrigin::TOP_CENTER; - map[ "anchorPoint" ] = AnchorPoint::TOP_LEFT; + map["parentOrigin"] = ParentOrigin::TOP_CENTER; + map["anchorPoint"] = AnchorPoint::TOP_LEFT; { - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); - application.GetScene().Add( handle ); + application.GetScene().Add(handle); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_CENTER, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::TOP_LEFT, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::ANCHOR_POINT), AnchorPoint::TOP_LEFT, TEST_LOCATION); - application.GetScene().Remove( handle ); + application.GetScene().Remove(handle); } // Check Anchor point and parent origin STRINGS - map[ "parentOrigin" ] = "TOP_LEFT"; - map[ "anchorPoint" ] = "CENTER_LEFT"; + map["parentOrigin"] = "TOP_LEFT"; + map["anchorPoint"] = "CENTER_LEFT"; { - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); - application.GetScene().Add( handle ); + application.GetScene().Add(handle); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::CENTER_LEFT, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER_LEFT, TEST_LOCATION); - application.GetScene().Remove( handle ); + application.GetScene().Remove(handle); } END_TEST; } @@ -253,25 +252,25 @@ int UtcDaliScriptingNewAnimation(void) TestApplication application; Property::Map map; - map["actor"] = "Actor1"; - map["property"] = "color"; - map["value"] = Color::MAGENTA; + map["actor"] = "Actor1"; + map["property"] = "color"; + map["value"] = Color::MAGENTA; map["alphaFunction"] = "EASE_IN_OUT"; Property::Map timePeriod; - timePeriod["delay"] = 0.5f; + timePeriod["delay"] = 0.5f; timePeriod["duration"] = 1.0f; - map["timePeriod"] = timePeriod; + map["timePeriod"] = timePeriod; Dali::AnimationData data; - Scripting::NewAnimation( map, data ); + Scripting::NewAnimation(map, data); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::NAME,"Actor1"); - actor.SetProperty( Actor::Property::COLOR,Color::CYAN); + actor.SetProperty(Actor::Property::NAME, "Actor1"); + actor.SetProperty(Actor::Property::COLOR, Color::CYAN); application.GetScene().Add(actor); - Animation anim = data.CreateAnimation( actor, 0.5f ); + Animation anim = data.CreateAnimation(actor, 0.5f); anim.Play(); application.SendNotification(); @@ -279,11 +278,11 @@ int UtcDaliScriptingNewAnimation(void) application.Render(500); // Start animation application.Render(500); // Halfway thru anim application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), (Color::MAGENTA+Color::CYAN)*0.5f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), (Color::MAGENTA + Color::CYAN) * 0.5f, TEST_LOCATION); application.Render(500); // Halfway thru anim application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::MAGENTA, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::MAGENTA, TEST_LOCATION); END_TEST; } @@ -293,39 +292,38 @@ int UtcDaliScriptingNewActorChildren(void) TestApplication application; Property::Map map; - map[ "type" ] = "Actor"; - map[ "position" ] = Vector3::XAXIS; + map["type"] = "Actor"; + map["position"] = Vector3::XAXIS; Property::Map child1Map; - child1Map[ "type" ] = "Layer"; - child1Map[ "position" ] = Vector3::YAXIS; + child1Map["type"] = "Layer"; + child1Map["position"] = Vector3::YAXIS; Property::Array childArray; - childArray.PushBack( child1Map ); - map[ "actors" ] = childArray; + childArray.PushBack(child1Map); + map["actors"] = childArray; // Create - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); - application.GetScene().Add( handle ); + application.GetScene().Add(handle); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::XAXIS, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::POSITION), Vector3::XAXIS, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetChildCount(), 1u, TEST_LOCATION); Actor child1 = handle.GetChildAt(0); - DALI_TEST_CHECK( child1 ); - DALI_TEST_CHECK( Layer::DownCast( child1 ) ); - DALI_TEST_EQUALS( child1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::YAXIS, TEST_LOCATION ); - DALI_TEST_EQUALS( child1.GetChildCount(), 0u, TEST_LOCATION ); + DALI_TEST_CHECK(child1); + DALI_TEST_CHECK(Layer::DownCast(child1)); + DALI_TEST_EQUALS(child1.GetCurrentProperty(Actor::Property::POSITION), Vector3::YAXIS, TEST_LOCATION); + DALI_TEST_EQUALS(child1.GetChildCount(), 0u, TEST_LOCATION); - application.GetScene().Remove( handle ); + application.GetScene().Remove(handle); END_TEST; } - int UtcDaliScriptingCreatePropertyMapActor(void) { TestApplication application; @@ -335,12 +333,12 @@ int UtcDaliScriptingCreatePropertyMapActor(void) Actor actor = Actor::New(); Property::Map map; - CreatePropertyMap( actor, map ); - DALI_TEST_CHECK( !map.Empty() ); - DALI_TEST_CHECK( NULL != map.Find( "type" ) ); - DALI_TEST_EQUALS( map.Find( "type")->Get< std::string >(), "Actor", TEST_LOCATION ); + CreatePropertyMap(actor, map); + DALI_TEST_CHECK(!map.Empty()); + DALI_TEST_CHECK(NULL != map.Find("type")); + DALI_TEST_EQUALS(map.Find("type")->Get(), "Actor", TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); } // Layer Type @@ -348,95 +346,95 @@ int UtcDaliScriptingCreatePropertyMapActor(void) Actor actor = Layer::New(); Property::Map map; - CreatePropertyMap( actor, map ); - DALI_TEST_CHECK( !map.Empty() ); - DALI_TEST_CHECK( NULL != map.Find( "type" ) ); - DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "Layer", TEST_LOCATION ); + CreatePropertyMap(actor, map); + DALI_TEST_CHECK(!map.Empty()); + DALI_TEST_CHECK(NULL != map.Find("type")); + DALI_TEST_EQUALS(map.Find("type")->Get(), "Layer", TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); } // Default properties { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector3::ONE ); - actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS ); - actor.SetProperty( Actor::Property::SCALE, Vector3::ZAXIS ); - actor.SetProperty( Actor::Property::VISIBLE, false ); - actor.SetProperty( Actor::Property::COLOR, Color::MAGENTA ); - actor.SetProperty( Actor::Property::NAME, "MyActor" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT ); - actor.SetProperty( Actor::Property::SENSITIVE, false ); - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); - actor.SetProperty( Actor::Property::INHERIT_ORIENTATION, false ); - actor.SetProperty( Actor::Property::INHERIT_SCALE, false ); - actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3::ONE ); - - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE); + actor.SetProperty(Actor::Property::POSITION, Vector3::XAXIS); + actor.SetProperty(Actor::Property::SCALE, Vector3::ZAXIS); + actor.SetProperty(Actor::Property::VISIBLE, false); + actor.SetProperty(Actor::Property::COLOR, Color::MAGENTA); + actor.SetProperty(Actor::Property::NAME, "MyActor"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT); + actor.SetProperty(Actor::Property::SENSITIVE, false); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); + actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false); + actor.SetProperty(Actor::Property::INHERIT_SCALE, false); + actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, Vector3::ONE); + + application.GetScene().Add(actor); application.SendNotification(); application.Render(); Property::Map map; - CreatePropertyMap( actor, map ); - - DALI_TEST_CHECK( !map.Empty() ); - DALI_TEST_CHECK( NULL != map.Find( "size" ) ); - DALI_TEST_EQUALS( map.Find( "size" )->Get< Vector3 >(), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "position" ) ); - DALI_TEST_EQUALS( map.Find( "position" )->Get< Vector3 >(), Vector3::XAXIS, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "scale" ) ); - DALI_TEST_EQUALS( map.Find( "scale" )->Get< Vector3 >(), Vector3::ZAXIS, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "visible" ) ); - DALI_TEST_EQUALS( map.Find( "visible" )->Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "color" ) ); - DALI_TEST_EQUALS( map.Find( "color" )->Get< Vector4 >(), Color::MAGENTA, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "name" ) ); - DALI_TEST_EQUALS( map.Find( "name")->Get< std::string >(), "MyActor", TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "anchorPoint" ) ); - DALI_TEST_EQUALS( map.Find( "anchorPoint" )->Get< Vector3 >(), AnchorPoint::CENTER_LEFT, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "parentOrigin" ) ); - DALI_TEST_EQUALS( map.Find( "parentOrigin" )->Get< Vector3 >(), ParentOrigin::TOP_RIGHT, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "sensitive" ) ); - DALI_TEST_EQUALS( map.Find( "sensitive" )->Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "leaveRequired" ) ); - DALI_TEST_EQUALS( map.Find( "leaveRequired" )->Get< bool >(), true, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "inheritOrientation" ) ); - DALI_TEST_EQUALS( map.Find( "inheritOrientation" )->Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "inheritScale" ) ); - DALI_TEST_EQUALS( map.Find( "inheritScale" )->Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "sizeModeFactor" ) ); - DALI_TEST_EQUALS( map.Find( "sizeModeFactor" )->Get< Vector3 >(), Vector3::ONE, TEST_LOCATION ); - - application.GetScene().Remove( actor ); + CreatePropertyMap(actor, map); + + DALI_TEST_CHECK(!map.Empty()); + DALI_TEST_CHECK(NULL != map.Find("size")); + DALI_TEST_EQUALS(map.Find("size")->Get(), Vector3::ONE, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("position")); + DALI_TEST_EQUALS(map.Find("position")->Get(), Vector3::XAXIS, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("scale")); + DALI_TEST_EQUALS(map.Find("scale")->Get(), Vector3::ZAXIS, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("visible")); + DALI_TEST_EQUALS(map.Find("visible")->Get(), false, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("color")); + DALI_TEST_EQUALS(map.Find("color")->Get(), Color::MAGENTA, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("name")); + DALI_TEST_EQUALS(map.Find("name")->Get(), "MyActor", TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("anchorPoint")); + DALI_TEST_EQUALS(map.Find("anchorPoint")->Get(), AnchorPoint::CENTER_LEFT, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("parentOrigin")); + DALI_TEST_EQUALS(map.Find("parentOrigin")->Get(), ParentOrigin::TOP_RIGHT, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("sensitive")); + DALI_TEST_EQUALS(map.Find("sensitive")->Get(), false, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("leaveRequired")); + DALI_TEST_EQUALS(map.Find("leaveRequired")->Get(), true, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("inheritOrientation")); + DALI_TEST_EQUALS(map.Find("inheritOrientation")->Get(), false, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("inheritScale")); + DALI_TEST_EQUALS(map.Find("inheritScale")->Get(), false, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("sizeModeFactor")); + DALI_TEST_EQUALS(map.Find("sizeModeFactor")->Get(), Vector3::ONE, TEST_LOCATION); + + application.GetScene().Remove(actor); } // Children { Actor actor = Actor::New(); Actor child = Layer::New(); - actor.Add( child ); + actor.Add(child); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); Property::Map map; - CreatePropertyMap( actor, map ); - DALI_TEST_CHECK( !map.Empty() ); + CreatePropertyMap(actor, map); + DALI_TEST_CHECK(!map.Empty()); - DALI_TEST_CHECK( NULL != map.Find( "type" ) ); - DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "Actor", TEST_LOCATION ); + DALI_TEST_CHECK(NULL != map.Find("type")); + DALI_TEST_EQUALS(map.Find("type")->Get(), "Actor", TEST_LOCATION); - DALI_TEST_CHECK( NULL != map.Find( "actors" ) ); - Property::Array children( map.Find( "actors")->Get< Property::Array >() ); - DALI_TEST_CHECK( !children.Empty() ); - Property::Map childMap( children[0].Get< Property::Map >() ); - DALI_TEST_CHECK( !childMap.Empty() ); - DALI_TEST_CHECK( childMap.Find( "type" ) ); - DALI_TEST_EQUALS( childMap.Find( "type" )->Get< std::string >(), "Layer", TEST_LOCATION ); + DALI_TEST_CHECK(NULL != map.Find("actors")); + Property::Array children(map.Find("actors")->Get()); + DALI_TEST_CHECK(!children.Empty()); + Property::Map childMap(children[0].Get()); + DALI_TEST_CHECK(!childMap.Empty()); + DALI_TEST_CHECK(childMap.Find("type")); + DALI_TEST_EQUALS(childMap.Find("type")->Get(), "Layer", TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); } END_TEST; } @@ -444,27 +442,27 @@ int UtcDaliScriptingCreatePropertyMapActor(void) int UtcDaliScriptingGetEnumerationTemplates(void) { const Scripting::StringEnum myTable[] = - { - { "ONE", 1 }, - { "TWO", 2 }, - { "THREE", 3 }, - { "FOUR", 4 }, - { "FIVE", 5 }, - }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + { + {"ONE", 1}, + {"TWO", 2}, + {"THREE", 3}, + {"FOUR", 4}, + {"FIVE", 5}, + }; + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); - for ( unsigned int i = 0; i < myTableCount; ++i ) + for(unsigned int i = 0; i < myTableCount; ++i) { - tet_printf("Checking: %s\n", myTable[ i ].string ); + tet_printf("Checking: %s\n", myTable[i].string); int value; - DALI_TEST_CHECK( GetEnumeration( myTable[ i ].string, myTable, myTableCount, value ) ); - DALI_TEST_EQUALS( myTable[ i ].value, value, TEST_LOCATION ); + DALI_TEST_CHECK(GetEnumeration(myTable[i].string, myTable, myTableCount, value)); + DALI_TEST_EQUALS(myTable[i].value, value, TEST_LOCATION); } - for ( unsigned int i = 0; i < myTableCount; ++i ) + for(unsigned int i = 0; i < myTableCount; ++i) { - tet_printf("Checking: %d\n", myTable[ i ].value ); - DALI_TEST_EQUALS( myTable[ i ].string, GetEnumerationName( myTable[ i ].value, myTable, myTableCount ), TEST_LOCATION ); + tet_printf("Checking: %d\n", myTable[i].value); + DALI_TEST_EQUALS(myTable[i].string, GetEnumerationName(myTable[i].value, myTable, myTableCount), TEST_LOCATION); } END_TEST; @@ -472,22 +470,22 @@ int UtcDaliScriptingGetEnumerationTemplates(void) int UtcDaliScriptingGetEnumerationNameN(void) { - const char* value = GetEnumerationName( 10, NULL, 0 ); - DALI_TEST_CHECK( NULL == value ); + const char* value = GetEnumerationName(10, NULL, 0); + DALI_TEST_CHECK(NULL == value); - value = GetEnumerationName( 10, NULL, 1 ); - DALI_TEST_CHECK( NULL == value ); + value = GetEnumerationName(10, NULL, 1); + DALI_TEST_CHECK(NULL == value); END_TEST; } int UtcDaliScriptingGetLinearEnumerationNameN(void) { - const char* value = GetLinearEnumerationName( 10, NULL, 0 ); - DALI_TEST_CHECK( NULL == value ); + const char* value = GetLinearEnumerationName(10, NULL, 0); + DALI_TEST_CHECK(NULL == value); - value = GetLinearEnumerationName( 10, NULL, 1 ); - DALI_TEST_CHECK( NULL == value ); + value = GetLinearEnumerationName(10, NULL, 1); + DALI_TEST_CHECK(NULL == value); END_TEST; } @@ -506,67 +504,67 @@ int UtcDaliScriptingGetEnumerationProperty(void) */ // String to Enum property table to test with (equivalent to ones used within DALi). - const Dali::Scripting::StringEnum testTable[] = { - { "NONE", FaceCullingMode::NONE }, - { "FRONT", FaceCullingMode::FRONT }, - { "BACK", FaceCullingMode::BACK }, - { "FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK } - }; const unsigned int testTableCount = sizeof( testTable ) / sizeof( testTable[0] ); + const Dali::Scripting::StringEnum testTable[] = { + {"NONE", FaceCullingMode::NONE}, + {"FRONT", FaceCullingMode::FRONT}, + {"BACK", FaceCullingMode::BACK}, + {"FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK}}; + const unsigned int testTableCount = sizeof(testTable) / sizeof(testTable[0]); // TEST: An enum can be looked up from a Property::Value of type INTEGER. // Initialise to first element. FaceCullingMode::Type result = FaceCullingMode::NONE; // Set the input property value to a different value (to emulate a change). - Property::Value propertyValueInteger( FaceCullingMode::FRONT ); + Property::Value propertyValueInteger(FaceCullingMode::FRONT); // Perform the lookup. - bool returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result ); + bool returnValue = GetEnumerationProperty(propertyValueInteger, testTable, testTableCount, result); // TEST: The return value is "true" if the property can be successfully converted AND it has changed // Check the property could be converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::FRONT ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::FRONT), TEST_LOCATION); // Now emulate a property-set with the same value. false should be returned. - returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result ); + returnValue = GetEnumerationProperty(propertyValueInteger, testTable, testTableCount, result); // TEST: The return value is "false" if the property can be successfully converted BUT it has NOT changed. - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::FRONT ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::FRONT), TEST_LOCATION); // TEST: An enum can be looked up from a Property::Value of type STRING. // Set the input property value to a different value (to emulate a change). - Property::Value propertyValueString( "BACK" ); + Property::Value propertyValueString("BACK"); - returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result ); + returnValue = GetEnumerationProperty(propertyValueString, testTable, testTableCount, result); - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); - returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result ); + returnValue = GetEnumerationProperty(propertyValueString, testTable, testTableCount, result); - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); // TEST: An enum can NOT be looked up for other Property::Value types. - Property::Value propertyValueBoolean( true ); + Property::Value propertyValueBoolean(true); - returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueBoolean, testTable, testTableCount, result ); + returnValue = GetEnumerationProperty(propertyValueBoolean, testTable, testTableCount, result); // TEST: The return value is "false" if the property can not be successfully converted. // Return value should be false as Property::Value was of an unsupported type for enum properties. - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // TEST: The result value is only updated if the return value is "true" (IE. successful conversion and property value has changed). // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); END_TEST; } @@ -593,106 +591,106 @@ int UtcDaliScriptingGetBitmaskEnumerationProperty(void) */ // String to Enum property table to test with (equivalent to ones used within DALi). - const Dali::Scripting::StringEnum testTable[] = { - { "NONE", FaceCullingMode::NONE }, - { "FRONT", FaceCullingMode::FRONT }, - { "BACK", FaceCullingMode::BACK }, - { "FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK } - }; const unsigned int testTableCount = sizeof( testTable ) / sizeof( testTable[0] ); + const Dali::Scripting::StringEnum testTable[] = { + {"NONE", FaceCullingMode::NONE}, + {"FRONT", FaceCullingMode::FRONT}, + {"BACK", FaceCullingMode::BACK}, + {"FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK}}; + const unsigned int testTableCount = sizeof(testTable) / sizeof(testTable[0]); // TEST: An enum can be looked up from a Property::Value of type INTEGER. // Initialise to first element. FaceCullingMode::Type result = FaceCullingMode::NONE; // Set the input property value to a different value (to emulate a change). - Property::Value propertyValueInteger( FaceCullingMode::FRONT ); + Property::Value propertyValueInteger(FaceCullingMode::FRONT); // Perform the lookup. - bool returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result ); + bool returnValue = GetBitmaskEnumerationProperty(propertyValueInteger, testTable, testTableCount, result); // TEST: The return value is "true" if the property can be successfully converted AND it has changed // Check the property could be converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::FRONT ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::FRONT), TEST_LOCATION); // TEST: An enum can be looked up from a Property::Value of type STRING. // Set the input property value to a different value (to emulate a change). - Property::Value propertyValueString( "BACK" ); + Property::Value propertyValueString("BACK"); - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyValueString, testTable, testTableCount, result); - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); // TEST: An enum can NOT be looked up from other Property::Value types. - Property::Value propertyValueVector( Vector3::ZERO ); + Property::Value propertyValueVector(Vector3::ZERO); - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueVector, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyValueVector, testTable, testTableCount, result); // TEST: The return value is "false" if the property can not be successfully converted. // Return value should be false as Property::Value was of an unsupported type for enum properties. - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // TEST: The result value is only updated if the return value is "true" (IE. successful conversion and property value has changed). // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); // Test PropertyArrays: // Property array of 2 integers. Property::Array propertyArrayIntegers; - propertyArrayIntegers.PushBack( FaceCullingMode::FRONT ); - propertyArrayIntegers.PushBack( FaceCullingMode::BACK ); + propertyArrayIntegers.PushBack(FaceCullingMode::FRONT); + propertyArrayIntegers.PushBack(FaceCullingMode::BACK); result = FaceCullingMode::NONE; - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayIntegers, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyArrayIntegers, testTable, testTableCount, result); // TEST: The return value when checking an array with 2 INTEGERS is "true" if the properties can be successfully converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); // TEST: The result value when checking an array with 2 INTEGERS is the ORd value of the 2 integers. - DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) ); + DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK)); // Property array of 2 strings. Property::Array propertyArrayStrings; - propertyArrayStrings.PushBack( "FRONT" ); - propertyArrayStrings.PushBack( "BACK" ); + propertyArrayStrings.PushBack("FRONT"); + propertyArrayStrings.PushBack("BACK"); result = FaceCullingMode::NONE; - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayStrings, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyArrayStrings, testTable, testTableCount, result); // TEST: The return value when checking an array with 2 STRINGS is "true" if the properties can be successfully converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); // TEST: The result value when checking an array with 2 STRINGS is the ORd value of the 2 integer equivalents of the strings. - DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) ); + DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK)); // Property array of an int and a string. Property::Array propertyArrayMixed; - propertyArrayMixed.PushBack( FaceCullingMode::FRONT ); - propertyArrayMixed.PushBack( "BACK" ); + propertyArrayMixed.PushBack(FaceCullingMode::FRONT); + propertyArrayMixed.PushBack("BACK"); result = FaceCullingMode::NONE; - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayMixed, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyArrayMixed, testTable, testTableCount, result); // TEST: The return value when checking an array with an INTEGER and a STRING is "true" if the properties can be successfully converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); // TEST: The result value when checking an array with an INTEGER and a STRING is the ORd value of the 2 integer equivalents of the strings. - DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) ); + DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK)); // Property array of an int and a string. Property::Array propertyArrayInvalid; - propertyArrayInvalid.PushBack( FaceCullingMode::FRONT ); - propertyArrayInvalid.PushBack( Vector3::ZERO ); + propertyArrayInvalid.PushBack(FaceCullingMode::FRONT); + propertyArrayInvalid.PushBack(Vector3::ZERO); // Set the initial value to non-zero, so we can test it does not change. result = FaceCullingMode::FRONT_AND_BACK; - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayInvalid, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyArrayInvalid, testTable, testTableCount, result); // TEST: The return value when checking an array with an INTEGER and a Vector3 is "false" as the properties can not be successfully converted. - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // TEST: The result value when checking an array with an INTEGER and a Vector3 is unchanged. - DALI_TEST_CHECK( result == FaceCullingMode::FRONT_AND_BACK ); + DALI_TEST_CHECK(result == FaceCullingMode::FRONT_AND_BACK); END_TEST; } @@ -701,14 +699,14 @@ int UtcDaliScriptingFindEnumIndexN(void) { const Scripting::StringEnum myTable[] = { - { "ONE", (1<<1) }, - { "TWO", (1<<2) }, - { "THREE", (1<<3) }, - { "FOUR", (1<<4) }, - { "FIVE", (1<<5) }, + {"ONE", (1 << 1)}, + {"TWO", (1 << 2)}, + {"THREE", (1 << 3)}, + {"FOUR", (1 << 4)}, + {"FIVE", (1 << 5)}, }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); - DALI_TEST_EQUALS( myTableCount, FindEnumIndex( "Foo", myTable, myTableCount ), TEST_LOCATION ); + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); + DALI_TEST_EQUALS(myTableCount, FindEnumIndex("Foo", myTable, myTableCount), TEST_LOCATION); END_TEST; } @@ -717,44 +715,43 @@ int UtcDaliScriptingEnumStringToIntegerP(void) { const Scripting::StringEnum myTable[] = { - { "ONE", (1<<1) }, - { "TWO", (1<<2) }, - { "THREE", (1<<3) }, - { "FOUR", (1<<4) }, - { "FIVE", (1<<5) }, + {"ONE", (1 << 1)}, + {"TWO", (1 << 2)}, + {"THREE", (1 << 3)}, + {"FOUR", (1 << 4)}, + {"FIVE", (1 << 5)}, }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); int integerEnum = 0; - DALI_TEST_CHECK( EnumStringToInteger( "ONE", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(EnumStringToInteger("ONE", myTable, myTableCount, integerEnum)); - DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION ); + DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION); integerEnum = 0; - DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "ONE,,TWO", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,,TWO", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO,THREE", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO,THREE", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO,THREE,FOUR,FIVE", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO,THREE,FOUR,FIVE", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "TWO,ONE", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("TWO,ONE", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "TWO,ONE,FOUR,THREE,FIVE", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("TWO,ONE,FOUR,THREE,FIVE", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "ONE,SEVEN", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION ); - - DALI_TEST_CHECK( EnumStringToInteger( "ONE,", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,SEVEN", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION); + DALI_TEST_CHECK(EnumStringToInteger("ONE,", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION); END_TEST; } @@ -762,29 +759,29 @@ int UtcDaliScriptingEnumStringToIntegerP(void) int UtcDaliScriptingEnumStringToIntegerN(void) { const Scripting::StringEnum myTable[] = - { - { "ONE", 1 }, - { "TWO", 2 }, - { "THREE", 3 }, - { "FOUR", 4 }, - { "FIVE", 5 }, - }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + { + {"ONE", 1}, + {"TWO", 2}, + {"THREE", 3}, + {"FOUR", 4}, + {"FIVE", 5}, + }; + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); int integerEnum = 0; - DALI_TEST_CHECK( !EnumStringToInteger( "Foo", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("Foo", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( "", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( ",", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(",", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( ",ONE,SEVEN", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(",ONE,SEVEN", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( ",", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(",", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( "ONE", myTable, 0, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("ONE", myTable, 0, integerEnum)); - DALI_TEST_EQUALS( integerEnum, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(integerEnum, 0, TEST_LOCATION); END_TEST; } @@ -792,17 +789,17 @@ int UtcDaliScriptingEnumStringToIntegerN(void) int UtcDaliScriptingEnumStringToIntegerInvalidEnumP(void) { const Scripting::StringEnum myTable[] = - { - { "", 1 }, - { "", 2 }, - { "", 3 }, - }; + { + {"", 1}, + {"", 2}, + {"", 3}, + }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); int integerEnum = 0; - DALI_TEST_CHECK( EnumStringToInteger( "", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, 1, TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, 1, TEST_LOCATION); END_TEST; } @@ -810,26 +807,26 @@ int UtcDaliScriptingEnumStringToIntegerInvalidEnumP(void) int UtcDaliScriptingEnumStringToIntegerInvalidEnumN(void) { const Scripting::StringEnum myTable[] = - { - { "", 1 }, - { "", 1 }, - { "", 1 }, - }; + { + {"", 1}, + {"", 1}, + {"", 1}, + }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); int integerEnum = 0; - DALI_TEST_CHECK( !EnumStringToInteger( NULL, NULL, 0, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(NULL, NULL, 0, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( "ONE", NULL, 0, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("ONE", NULL, 0, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( NULL, myTable, 0, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(NULL, myTable, 0, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( NULL, myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(NULL, myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( "ONE", NULL, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("ONE", NULL, myTableCount, integerEnum)); - DALI_TEST_EQUALS( integerEnum, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(integerEnum, 0, TEST_LOCATION); END_TEST; }