END_TEST;
}
+int UtcDaliActorSetParentOriginIndividual(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ Vector3 vector(0.7f, 0.8f, 0.9f);
+ DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
+
+ actor.SetProperty( Actor::Property::PARENT_ORIGIN_X, vector.x );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.x, actor.GetCurrentParentOrigin().x, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::PARENT_ORIGIN_Y, vector.y );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.y, actor.GetCurrentParentOrigin().y, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::PARENT_ORIGIN_Z, vector.z );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.z, actor.GetCurrentParentOrigin().z, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliActorGetCurrentParentOrigin(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliActorSetAnchorPointIndividual(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ Vector3 vector(0.7f, 0.8f, 0.9f);
+ DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
+
+ actor.SetProperty( Actor::Property::ANCHOR_POINT_X, vector.x );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.x, actor.GetCurrentAnchorPoint().x, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::ANCHOR_POINT_Y, vector.y );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.y, actor.GetCurrentAnchorPoint().y, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::ANCHOR_POINT_Z, vector.z );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.z, actor.GetCurrentAnchorPoint().z, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliActorGetCurrentAnchorPoint(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliActorSetSizeIndividual(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ Vector3 vector(0.7f, 0.8f, 0.9f);
+ DALI_TEST_CHECK(vector != actor.GetCurrentSize());
+
+ actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.width, actor.GetCurrentSize().width, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.height, actor.GetCurrentSize().height, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.depth, actor.GetCurrentSize().depth, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
int UtcDaliActorGetCurrentSize(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliActorSetPositionProperties(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ Vector3 vector(0.7f, 0.8f, 0.9f);
+ DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
+
+ actor.SetProperty( Actor::Property::POSITION_X, vector.x );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.x, actor.GetCurrentPosition().x, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::POSITION_Y, vector.y );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.y, actor.GetCurrentPosition().y, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::POSITION_Z, vector.z );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.z, actor.GetCurrentPosition().z, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliActorTranslateBy(void)
{
TestApplication application;
END_TEST;
}
+// SetOrientation(float angleRadians, Vector3 axis)
+int UtcDaliActorSetOrientationProperty(void)
+{
+ TestApplication application;
+
+ Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Actor actor = Actor::New();
+
+ actor.SetProperty( Actor::Property::ORIENTATION, rotation );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
+ END_TEST;
+}
+
// RotateBy(float angleRadians, Vector3 axis)
int UtcDaliActorRotateBy01(void)
{
END_TEST;
}
+int UtcDaliActorSetScaleIndividual(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ Vector3 vector(0.7f, 0.8f, 0.9f);
+ DALI_TEST_CHECK(vector != actor.GetCurrentScale());
+
+ actor.SetProperty( Actor::Property::SCALE_X, vector.x );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.x, actor.GetCurrentScale().x, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::SCALE_Y, vector.y );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.y, actor.GetCurrentScale().y, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::SCALE_Z, vector.z );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.z, actor.GetCurrentScale().z, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliActorScaleBy(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliActorSetColorIndividual(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
+ DALI_TEST_CHECK(vector != actor.GetCurrentColor());
+
+ actor.SetProperty( Actor::Property::COLOR_RED, vector.r );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.r, actor.GetCurrentColor().r, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::COLOR_GREEN, vector.g );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.g, actor.GetCurrentColor().g, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::COLOR_BLUE, vector.b );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.b, actor.GetCurrentColor().b, TEST_LOCATION );
+
+ actor.SetProperty( Actor::Property::COLOR_ALPHA, vector.a );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( vector.a, actor.GetCurrentColor().a, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
int UtcDaliActorGetCurrentColor(void)
{
TestApplication application;
DALI_TEST_EQUALS(0u, detector.GetAttachedActorCount(), TEST_LOCATION);
END_TEST;
}
+
+int UtcDaliGestureDetectorProperties(void)
+{
+ TestApplication application;
+
+ // Use pinch gesture as that doen't currently have any properties. Will need to change it if default properties are added.
+ GestureDetector detector = PinchGestureDetector::New();
+
+ DALI_TEST_EQUALS( detector.GetPropertyCount(), 0u, TEST_LOCATION );
+
+ Property::IndexContainer indices;
+ detector.GetPropertyIndices( indices );
+ DALI_TEST_EQUALS( indices.Size(), 0u, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( detector.IsPropertyWritable( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.IsPropertyAnimatable( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.IsPropertyAConstraintInput( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetPropertyType( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), Property::NONE, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetPropertyIndex( "InvalidIndex" ), Property::INVALID_INDEX, TEST_LOCATION );
+
+ Property::Value propValue = detector.GetProperty( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX );
+ DALI_TEST_EQUALS( propValue.GetType(), Property::NONE, TEST_LOCATION );
+
+ // For coverage only, not testable
+ detector.SetProperty( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX, true );
+
+ END_TEST;
+}
struct ConstraintData
{
ConstraintData()
- : called(false)
+ : panning( false ),
+ called( false )
{
}
Vector2 localPosition;
Vector2 localDisplacement;
Vector2 localVelocity;
+ bool panning;
bool called;
void Reset()
{
screenPosition = screenDisplacement = screenVelocity = localPosition = localDisplacement = localVelocity = Vector2::ZERO;
+ panning = false;
called = false;
}
};
constraintData.localPosition = inputs[3]->GetVector2();
constraintData.localDisplacement = inputs[4]->GetVector2();
constraintData.localVelocity = inputs[5]->GetVector2();
+ constraintData.panning = inputs[6]->GetBoolean();
constraintData.called = true;
current = Vector3::ZERO;
}
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
constraint.Apply();
// Render and notify
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
constraint.Apply();
// Render and notify
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
constraint.Apply();
// Render and notify
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
constraint.Apply();
// Render and notify
detector.DetectedSignal().Connect( &application, functor );
Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index animatableGestureProperty = detector.RegisterProperty( "Dummy Property", Vector3::ZERO ); // For code coverage
ConstraintData constraintData;
Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ constraint.AddSource( Source( detector, animatableGestureProperty ) );
constraint.Apply();
// Render and notify
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+ constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
constraint.Apply();
// Render and notify
END_TEST;
}
+namespace
+{
+struct PropertyStringIndex
+{
+ const char * const name;
+ const Property::Index index;
+ const Property::Type type;
+ const Property::Value value;
+};
+
+const PropertyStringIndex PROPERTY_TABLE[] =
+{
+ { "screenPosition", PanGestureDetector::Property::SCREEN_POSITION, Property::VECTOR2, Vector2::ZERO },
+ { "screenDisplacement", PanGestureDetector::Property::SCREEN_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO },
+ { "screenVelocity", PanGestureDetector::Property::SCREEN_VELOCITY, Property::VECTOR2, Vector2::ZERO },
+ { "localPosition", PanGestureDetector::Property::LOCAL_POSITION, Property::VECTOR2, Vector2::ZERO },
+ { "localDisplacement", PanGestureDetector::Property::LOCAL_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO },
+ { "localVelocity", PanGestureDetector::Property::LOCAL_VELOCITY, Property::VECTOR2, Vector2::ZERO },
+ { "panning", PanGestureDetector::Property::PANNING, Property::BOOLEAN, false },
+};
+const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
+} // unnamed namespace
+
+
+int UtcDaliPanGestureProperties(void)
+{
+ TestApplication application;
+ PanGestureDetector detector = PanGestureDetector::New();
+
+ for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
+ {
+ DALI_TEST_EQUALS( detector.GetPropertyName( PROPERTY_TABLE[ i ].index ), std::string( PROPERTY_TABLE[ i ].name ), TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetPropertyIndex( PROPERTY_TABLE[ i ].name ), PROPERTY_TABLE[ i ].index, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetPropertyType( PROPERTY_TABLE[ i ].index ), PROPERTY_TABLE[ i ].type, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.IsPropertyWritable( PROPERTY_TABLE[ i ].index ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.IsPropertyAnimatable( PROPERTY_TABLE[ i ].index ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.IsPropertyAConstraintInput( PROPERTY_TABLE[ i ].index ), true, TEST_LOCATION );
+ detector.SetProperty( PROPERTY_TABLE[ i ].index, Property::Value() ); // Just for Coverage
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPanGestureGetProperty(void)
+{
+ TestApplication application;
+ PanGestureDetector detector = PanGestureDetector::New();
+
+ for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
+ {
+ if( PROPERTY_TABLE[ i ].type == Property::VECTOR2 )
+ {
+ bool value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< bool >();
+ DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< bool >(), value, TEST_LOCATION );
+ }
+ else if( PROPERTY_TABLE[ i ].type == Property::BOOLEAN )
+ {
+ Vector2 value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< Vector2 >();
+ DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< Vector2 >(), value, TEST_LOCATION );
+ }
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPanGestureGetPropertyWithSceneObject(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ actor.SetSize(100.0f, 100.0f);
+ actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(actor);
+
+ // Add a pan detector
+ PanGestureDetector detector = PanGestureDetector::New();
+ detector.Attach( actor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
+ {
+ detector.SetProperty( PROPERTY_TABLE[ i ].index, Property::Value() ); // Just for Coverage
+
+ if( PROPERTY_TABLE[ i ].type == Property::VECTOR2 )
+ {
+ bool value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< bool >();
+ DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< bool >(), value, TEST_LOCATION );
+ }
+ else if( PROPERTY_TABLE[ i ].type == Property::BOOLEAN )
+ {
+ Vector2 value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< Vector2 >();
+ DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< Vector2 >(), value, TEST_LOCATION );
+ }
+ }
+
+ END_TEST;
+}
+
int UtcDaliPanGestureLayerConsumesTouch(void)
{
TestApplication application;
}
}
-void Actor::SetOverlay( bool enable )
-{
- // Setting STENCIL will override OVERLAY_2D
- if( DrawMode::STENCIL != mDrawMode )
- {
- SetDrawMode( enable ? DrawMode::OVERLAY_2D : DrawMode::NORMAL );
- }
-}
-
bool Actor::IsOverlay() const
{
return ( DrawMode::OVERLAY_2D == mDrawMode );
DrawMode::Type GetDrawMode() const;
/**
- * @copydoc Dali::Actor::SetOverlay
- */
- void SetOverlay( bool enable );
-
- /**
* @copydoc Dali::Actor::IsOverlay
*/
bool IsOverlay() const;
Property::Index GestureDetector::GetDefaultPropertyIndex(const std::string& name) const
{
- return 0;
+ return Property::INVALID_INDEX;
}
bool GestureDetector::IsDefaultPropertyWritable(Property::Index index) const
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
{
- index = i;
+ index = DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX + i;
break;
}
}