X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-TypeRegistry.cpp;h=fe65d5e9c41c3314b5f37d838efaef6ac793fa7c;hb=baad1726f5f7f05d98da7ca591f24dbe3c49dab2;hp=fb2bb5b114edb8edc4523722d75a129914f25f3f;hpb=16cb8b3fafec2ae61ce0397318eb0cd28bedc9ea;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp index fb2bb5b..fe65d5e 100644 --- a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp +++ b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -21,10 +21,6 @@ #include #include #include -#include -#include -#include -#include #include #include @@ -82,70 +78,6 @@ struct GestureReceivedFunctor SignalData& signalData; }; -// Generate a LongPressGestureEvent to send to Core -Integration::LongPressGestureEvent GenerateLongPress( - Gesture::State state, - unsigned int numberOfTouches, - Vector2 point) -{ - Integration::LongPressGestureEvent longPress( state ); - - longPress.numberOfTouches = numberOfTouches; - longPress.point = point; - - return longPress; -} - -// Generate a PanGestureEvent to send to Core -Integration::PanGestureEvent GeneratePan( - Gesture::State state, - Vector2 previousPosition, - Vector2 currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1, - unsigned int time = 1u) -{ - Integration::PanGestureEvent pan(state); - - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - pan.time = time; - - return pan; -} -// Generate a PinchGestureEvent to send to Core -Integration::PinchGestureEvent GeneratePinch( - Gesture::State state, - float scale, - float speed, - Vector2 centerpoint) -{ - Integration::PinchGestureEvent pinch(state); - - pinch.scale = scale; - pinch.speed = speed; - pinch.centerPoint = centerpoint; - - return pinch; -} -// Generate a TapGestureEvent to send to Core -Integration::TapGestureEvent GenerateTap( - Gesture::State state, - unsigned int numberOfTaps, - unsigned int numberOfTouches, - Vector2 point) -{ - Integration::TapGestureEvent tap( state ); - - tap.numberOfTaps = numberOfTaps; - tap.numberOfTouches = numberOfTouches; - tap.point = point; - - return tap; -} - // // Create function as Init function called // @@ -1074,7 +1006,7 @@ int UtcDaliTypeRegistryPropertyRegistrationP(void) typeInfo.GetPropertyIndices( indices ); size_t typePropertyCount = typeInfo.GetPropertyCount(); - DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( indices.Size(), Actor::New().GetPropertyCount() + 1u, TEST_LOCATION ); DALI_TEST_EQUALS( indices.Size(), typePropertyCount, TEST_LOCATION ); // Ensure indices returned from actor and customActor differ by two @@ -1164,7 +1096,7 @@ int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void) // Check property count of type-info is 1 Property::IndexContainer indices; typeInfo.GetPropertyIndices( indices ); - DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION ); // Ensure indices returned from actor and customActor differ by one Actor actor = Actor::New(); @@ -1267,10 +1199,10 @@ int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void) // Check the animatable property type DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION ); - // Check property count of type-info is 1 + // Check property count of type-info Property::IndexContainer indices; typeInfo.GetPropertyIndices( indices ); - DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION ); // Ensure indices returned from actor and customActor differ by one Actor actor = Actor::New(); @@ -1376,10 +1308,10 @@ int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void) // Check the animatable property type DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION ); - // Check property count of type-info is 1 + // Check property count of type-info Property::IndexContainer indices; typeInfo.GetPropertyIndices( indices ); - DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION ); // Register animatable property components std::string animatablePropertyComponentName1( "animatableProp1X" ); @@ -2057,24 +1989,14 @@ int UtcDaliPropertyRegistrationPropertyWritableP(void) int UtcDaliPropertyRegistrationPropertyWritableN(void) { - // Currently Actors don't register properties with the type registry - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) ); Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo ); - try - { - typeInfoImpl.IsPropertyWritable( Actor::Property::COLOR); - tet_result( TET_FAIL ); + DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( Actor::Property::COLOR), true, TEST_LOCATION ); - } - catch ( DaliException& e ) - { - DALI_TEST_ASSERT( e, "Cannot find property index", TEST_LOCATION ); - } END_TEST; - } + int UtcDaliPropertyRegistrationPropertyAnimatable(void) { TestApplication application; @@ -2111,7 +2033,7 @@ int UtcDaliPropertyRegistrationPropertyAnimatable(void) END_TEST; } -int UtcDaliPropertyRegistrationInvalidGetAndSet(void) +int UtcDaliPropertyRegistrationUnregisteredGetAndSet(void) { TestApplication application; int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000; @@ -2125,47 +2047,14 @@ int UtcDaliPropertyRegistrationInvalidGetAndSet(void) Actor customActor = Actor::DownCast( handle ); DALI_TEST_CHECK( customActor ); - // Try to set an index that hasn't been added - try - { - customActor.SetProperty( propertyIndex, true ); - tet_result( TET_FAIL ); - } - catch ( DaliException& e ) - { - DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION ); - } - - try - { - customActor.SetProperty( animatablePropertyIndex, true ); - tet_result( TET_FAIL ); - } - catch ( DaliException& e ) - { - DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION ); - } + // Try to set an index that hasn't been registered, this is a no-op for now, to be fixed in future + customActor.SetProperty( propertyIndex, true ); +// DALI_TEST_EQUALS( true, customActor.GetProperty( propertyIndex ).Get(), TEST_LOCATION); - // Try to get an index that hasn't been added - try - { - (void) customActor.GetProperty< bool >( propertyIndex ); - tet_result( TET_FAIL ); - } - catch ( DaliException& e ) - { - DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION ); - } + // Try to set an index that hasn't been registered + customActor.SetProperty( animatablePropertyIndex, true ); + DALI_TEST_EQUALS( true, customActor.GetProperty( animatablePropertyIndex ).Get(), TEST_LOCATION); - try - { - (void) customActor.GetProperty< bool >( animatablePropertyIndex ); - tet_result( TET_FAIL ); - } - catch ( DaliException& e ) - { - DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION ); - } END_TEST; } @@ -2201,9 +2090,9 @@ int UtcDaliLongPressGestureDetectorTypeRegistry(void) application.Render(); // Emit gesture - application.ProcessEvent(GenerateLongPress(Gesture::Possible, 1u, Vector2(50.0f, 10.0f))); - application.ProcessEvent(GenerateLongPress(Gesture::Started, 1u, Vector2(50.0f, 10.0f))); - application.ProcessEvent(GenerateLongPress(Gesture::Finished, 1u, Vector2(50.0f, 10.0f))); + TestGenerateLongPress( application, 50.0f, 10.0f ); + TestEndLongPress( application, 50.0f, 10.0f ); + DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; } @@ -2239,9 +2128,7 @@ int UtcDaliPanGestureDetectorTypeRegistry(void) application.Render(); // Emit gesture - application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10)); + TestGenerateMiniPan( application ); DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; } @@ -2277,7 +2164,8 @@ int UtcDaliPinchGestureDetectorTypeRegistry(void) application.Render(); // Emit gesture - application.ProcessEvent(GeneratePinch(Gesture::Started, 10.0f, 50.0f, Vector2(20.0f, 10.0f))); + TestGeneratePinch( application ); + DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; } @@ -2313,8 +2201,8 @@ int UtcDaliTapGestureDetectorTypeRegistry(void) application.Render(); // Emit gesture - application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f))); - application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f))); + TestGenerateTap( application, 50.0, 10.0, 100 ); + DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; } @@ -2490,7 +2378,7 @@ int UtcDaliTypeInfoGetPropertyCountP1(void) DALI_TEST_CHECK( typeInfo ); size_t actorPropertyCount = typeInfo.GetPropertyCount(); - DALI_TEST_EQUALS( actorPropertyCount == 0 , true, TEST_LOCATION ); // No event only props + DALI_TEST_EQUALS( actorPropertyCount, Actor::New().GetPropertyCount(), TEST_LOCATION ); // No event only props END_TEST; } @@ -2506,7 +2394,7 @@ int UtcDaliTypeInfoGetPropertyCountP2(void) typeInfo.GetPropertyIndices( indices ); DALI_TEST_EQUALS( propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( propertyCount == 2, true, TEST_LOCATION ); + DALI_TEST_EQUALS( propertyCount, Actor::New().GetPropertyCount() + 2, TEST_LOCATION ); END_TEST; }