# Clean up old coverage data
if [ -d ../build/tizen ] ; then
- rm -f ../build/tizen/dali-toolkit/.libs/*.gcda
+ rm -f ../build/tizen/dali/.libs/*.gcda
fi
find build \( -name "*.gcda" \) -exec rm '{}' \;
ret=$?
if [ $ret -ne 6 ] ; then
if [ $opt_debug -ne 0 ] ; then
- if [ $ret -eq 0 ] ; then
- gdb --args build/src/$mod/tct-$mod-core $1
- fi
+ echo DEBUGGING:
+ gdb --args build/src/$mod/tct-$mod-core $1
+
else
echo $output
if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
END_TEST;
}
-int UtcDaliActorRemoveRendererP(void)
+int UtcDaliActorRemoveRendererP1(void)
+{
+ tet_infoline("Testing Actor::RemoveRenderer");
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+
+ Geometry geometry = Geometry::QUAD();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ actor.AddRenderer( renderer );
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
+
+ actor.RemoveRenderer(renderer);
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+int UtcDaliActorRemoveRendererP2(void)
{
tet_infoline("Testing Actor::RemoveRenderer");
TestApplication application;
END_TEST;
}
+
+
+int UtcDaliActorRemoveRendererN(void)
+{
+ tet_infoline("Testing Actor::RemoveRenderer");
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+
+ Geometry geometry = Geometry::QUAD();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ actor.AddRenderer( renderer );
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
+
+ actor.RemoveRenderer(10);
+ DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+
+ END_TEST;
+}
{
}
+
+TestNativeImageNoExtPointer TestNativeImageNoExt::New(int width, int height)
+{
+ return new TestNativeImageNoExt(width, height);
+}
+
+TestNativeImageNoExt::TestNativeImageNoExt(int width, int height)
+: mWidth(width), mHeight(height), mExtensionCreateCalls(0), mExtensionDestroyCalls(0), mTargetTextureCalls(0),createResult(true)
+{
+}
+
+TestNativeImageNoExt::~TestNativeImageNoExt()
+{
+}
+
} // namespace dali
namespace Dali
{
class TestNativeImage;
+class TestNativeImageNoExt;
typedef IntrusivePtr<TestNativeImage> TestNativeImagePointer;
+typedef IntrusivePtr<TestNativeImageNoExt> TestNativeImageNoExtPointer;
class DALI_IMPORT_API TestNativeImageExtension: public Dali::NativeImageInterface::Extension
{
TestNativeImageExtension* mExtension;
};
+
+class DALI_IMPORT_API TestNativeImageNoExt : public Dali::NativeImageInterface
+{
+public:
+ static TestNativeImageNoExtPointer New(int width, int height);
+
+ inline void SetGlExtensionCreateResult(bool result){ createResult = result;}
+ inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return createResult;};
+ inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; };
+ inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 1;};
+ inline virtual void PrepareTexture() {};
+ inline virtual unsigned int GetWidth() const {return mWidth;};
+ inline virtual unsigned int GetHeight() const {return mHeight;};
+ inline virtual bool RequiresBlending() const {return true;};
+
+private:
+ TestNativeImageNoExt(int width, int height);
+ virtual ~TestNativeImageNoExt();
+
+ int mWidth;
+ int mHeight;
+public:
+ int mExtensionCreateCalls;
+ int mExtensionDestroyCalls;
+ int mTargetTextureCalls;
+ bool createResult;
+};
+
} // Dali
#endif
END_TEST;
}
-
int UtcDaliBaseHandleCopyConstructor(void)
{
TestApplication application;
}
// Positive test case for constructors:
-int UtcDaliEncodedBufferImageNew01(void)
+int UtcDaliEncodedBufferImageNewP1(void)
{
TestApplication application;
END_TEST;
}
+// Positive test case for constructors:
+int UtcDaliEncodedBufferImageNewP2(void)
+{
+ TestApplication application;
+
+ tet_infoline( "UtcDaliEncodedBufferImageNew01() - EncodedBufferImage::New( const uint8_t * const encodedImage, const std::size_t encodedImageByteCount, ImageDimensions size, FittingMode::Type scalingMode, SamplingMode::Type samplingMode, ReleasePolicy releasePol, bool orientationCorrection )" );
+
+ // Invoke default handle constructor for the Image base class:
+ Image image;
+
+ DALI_TEST_CHECK( !image );
+
+ // Trigger image decode to initialise the handle
+ image = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
+
+ DALI_TEST_CHECK( image );
+
+ Image image2;
+ DALI_TEST_CHECK( !image2 );
+ // Trigger image decode to initialise the handle
+ image2 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength);
+
+ DALI_TEST_CHECK( image2 );
+ END_TEST;
+}
+
+
// Negative test case for constructor - null pointer:
-int UtcDaliEncodedBufferImageNew02(void)
+int UtcDaliEncodedBufferImageNewN1(void)
{
TestApplication application;
}
// Negative test case for constructor - zero-length input buffer:
-int UtcDaliEncodedBufferImageNew03(void)
+int UtcDaliEncodedBufferImageNewN2(void)
{
TestApplication application;
++g_destructionCountUnrelated;
}
};
-}
+
+class TestObject : public RefObject
+{
+public:
+ TestObject()
+ : data(201)
+ {
+ }
+
+ TestObject(const TestObject& testObject)
+ : RefObject(testObject),
+ data(testObject.data)
+ {
+ }
+
+ TestObject& Assign(const TestObject& testObject)
+ {
+ RefObject::operator=(testObject);
+ data = testObject.data;
+ return *this;
+ }
+
+ int data;
+};
+
+
+} // Anonymous namespace
/**
* Test that a default constructed pointer is null and harmless.
DALI_TEST_EQUALS( operator!=( counted2.Get(), countedSubclass2 ), false, TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliRefObjectCopyConstructor(void)
+{
+ tet_infoline("Test for Dali::RefObject(const RefObject&)");
+
+ {
+ IntrusivePtr<TestObject> testPtr( new TestObject );
+ DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+
+ const TestObject& testObject=*testPtr.Get();
+ {
+ IntrusivePtr<TestObject> testPtr2( new TestObject(testObject) );
+ DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 1, TEST_LOCATION );
+ }
+ DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+ }
+ END_TEST;
+}
+
+
+int UtcDaliRefObjectAssignmentOperator(void)
+{
+ tet_infoline("Test for Dali::RefObject::operator=(const RefObject&)");
+
+ {
+ IntrusivePtr<TestObject> testPtr( new TestObject );
+ DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+
+ const TestObject& testObject=*testPtr.Get();
+ {
+ IntrusivePtr<TestObject> testPtr2( new TestObject() );
+ testPtr->data = 33;
+ IntrusivePtr<TestObject> testPtr3 = testPtr2;
+ DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS( testPtr2->data, 201, TEST_LOCATION );
+
+ TestObject& testObject2 = *testPtr2.Get();
+ testObject2 = testObject;
+
+ DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 2, TEST_LOCATION );
+ }
+ DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+ }
+ END_TEST;
+}
TestNativeImagePointer testNativeImage = TestNativeImage::New( 16, 16 );
DALI_TEST_CHECK( testNativeImage );
-
DALI_TEST_CHECK( NULL != testNativeImage->GetExtension() );
+ TestNativeImageNoExtPointer testNativeImage2 = TestNativeImageNoExt::New( 16, 16 );
+ DALI_TEST_CHECK( testNativeImage2 );
+ DALI_TEST_CHECK( NULL == testNativeImage2->GetExtension() );
+
END_TEST;
}
tet_printf("stretchBorders left(%f) right(%f) top(%f) bottom(%f)\n", stretchBorders.x, stretchBorders.z, stretchBorders.y, stretchBorders.w );
DALI_TEST_CHECK( stretchBorders == requiredStretchBorder );
+
+ Vector4 actualStretchBorders = ninePatchImage.GetStretchBorders();
+ DALI_TEST_EQUALS( actualStretchBorders, requiredStretchBorder, 0.001, TEST_LOCATION );
}
else
{
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 1 );
- value = map.Find( "world" );
+ const std::string world("world");
+ value = map.Find( world );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 2 );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 9 );
- value = map.Find( 10 );
+ value = map.Find( 10, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
+ value = map.Find( 10, Property::INTEGER );
+ DALI_TEST_CHECK( value == NULL );
+
value = map.Find( "invalidKey" );
DALI_TEST_CHECK( !value );
END_TEST;
}
+
+int UtcDaliPropertyMapOperatorIndex(void)
+{
+ Property::Map map;
+ map[ "hello" ] = 1;
+ map[ 10 ] = "DALi";
+ map[ "world" ] = 2;
+ map[ 100 ] = 9;
+
+ const Property::Map map2 = map;
+ const Property::Value& value10 = map2[10];
+ DALI_TEST_EQUALS( value10.Get<std::string>(), "DALi", TEST_LOCATION );
+
+ const Property::Value& value100 = map2[100];
+ DALI_TEST_EQUALS( value100.Get<int>(), 9, TEST_LOCATION );
+
+ const Property::Value& valueHello = map2["hello"];
+ DALI_TEST_EQUALS( valueHello.Get<int>(), 1, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliPropertyMapInsertP(void)
{
Property::Map map;
receivedTouchEvent.points.clear();
receivedTouchEvent.time = 0;
+
+ receivedTouchData.Reset();
}
bool functorCalled;
TouchEvent receivedTouchEvent;
+ TouchData receivedTouchData;
};
// Functor that sets the data when touched signal is received
TouchedSignalData& signalData;
};
+
+// Functor that sets the data when touched signal is received
+struct TouchFunctor
+{
+ TouchFunctor( TouchedSignalData& data ) : signalData( data ) { }
+
+ void operator()( const TouchData& touch )
+ {
+ signalData.functorCalled = true;
+ signalData.receivedTouchData = touch;
+ }
+
+ TouchedSignalData& signalData;
+};
+
// Stores data that is populated in the wheel-event callback and will be read by the TET cases
struct WheelEventSignalData
{
END_TEST;
}
+
+int UtcDaliStageTouchSignalP(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ TouchedSignalData data;
+ TouchFunctor functor( data );
+ stage.TouchSignal().Connect( &application, functor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Basic test: No actors, single touch (down then up).
+ {
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ data.Reset();
+
+ GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ data.Reset();
+ }
+
+ // Add an actor to the scene.
+ Actor actor = Actor::New();
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
+ stage.Add( actor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Actor on scene, single touch, down in actor, motion, then up outside actor.
+ {
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( data.receivedTouchData.GetHitActor(0) == actor );
+ data.Reset();
+
+ GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion
+
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ data.Reset();
+ }
+
+ // Multiple touch. Should only receive a touch on first down and last up.
+ {
+ Integration::TouchEvent touchEvent;
+ Integration::Point point;
+
+ // 1st point
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+ touchEvent.points.push_back( point );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
+ data.Reset();
+
+ // 2nd point
+ touchEvent.points[0].SetState( PointState::STATIONARY );
+ point.SetDeviceId( 1 );
+ point.SetScreenPosition( Vector2( 50.0f, 50.0f ) );
+ touchEvent.points.push_back( point );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ // Primary point is up
+ touchEvent.points[0].SetState( PointState::UP );
+ touchEvent.points[1].SetState( PointState::STATIONARY );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ // Remove 1st point now, 2nd point is now in motion
+ touchEvent.points.erase( touchEvent.points.begin() );
+ touchEvent.points[0].SetState( PointState::MOTION );
+ touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ // Final point Up
+ touchEvent.points[0].SetState( PointState::UP );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
+ data.Reset();
+ }
+ END_TEST;
+}
+
+int UtcDaliStageTouchSignalN(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ TouchedSignalData data;
+ TouchFunctor functor( data );
+ stage.TouchSignal().Connect( &application, functor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Confirm functor not called before there has been any touch event.
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+
+ // No actors, single touch, down, motion then up.
+ {
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0));
+ data.Reset();
+
+ // Confirm there is no signal when the touchpoint is only moved.
+ GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion
+
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ data.Reset();
+
+ // Confirm a following up event generates a signal.
+ GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0));
+ data.Reset();
+ }
+
+ // Add an actor to the scene.
+ Actor actor = Actor::New();
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
+ stage.Add( actor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Actor on scene. Interrupted before down and interrupted after down.
+ {
+ GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::INTERRUPTED );
+ data.Reset();
+
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( data.receivedTouchData.GetHitActor(0) == actor );
+ DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::DOWN );
+ data.Reset();
+
+ GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
+ DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
+ DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::INTERRUPTED );
+
+ DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
+
+ // Check that getting info about a non-existent point returns an empty handle
+ Actor actor = data.receivedTouchData.GetHitActor( 1 );
+ DALI_TEST_CHECK( !actor );
+
+ data.Reset();
+ }
+
+ END_TEST;
+}
+
int UtcDaliStageSignalWheelEventP(void)
{
TestApplication application;
END_TEST;
}
+
+int UtcDaliStageOperatorAssign(void)
+{
+ TestApplication app;
+ Stage stage;
+ DALI_TEST_CHECK( !stage );
+
+ stage = Stage::GetCurrent();
+ DALI_TEST_CHECK( stage );
+
+ END_TEST;
+}
bool returnValue;
};
+struct HandleData
+{
+ bool signalReceived;
+ TouchData touchData;
+
+ HandleData()
+ : signalReceived(false)
+ {
+ }
+};
+
+struct TouchDataHandleFunctor
+{
+ /**
+ * Constructor.
+ * @param[in] data Reference to the data to store callback information.
+ * @param[in] returnValue What the functor should return.
+ */
+ TouchDataHandleFunctor( HandleData& handleData, bool returnValue = true )
+ : handleData(handleData),
+ returnValue( returnValue )
+ {
+ }
+
+ bool operator()( Actor actor, const TouchData& someTouchData )
+ {
+ handleData.signalReceived = true;
+ TouchData handle(someTouchData);
+ handleData.touchData = handle;
+ return returnValue;
+ }
+
+ HandleData& handleData;
+ bool returnValue;
+};
+
+
// Functor that removes the actor when called.
struct RemoveActorFunctor : public TouchDataFunctor
{
///////////////////////////////////////////////////////////////////////////////
-int UtcDaliTouchDataNormalProcessing(void)
+int UtcDaliTouchDataNormalProcessing01(void)
{
TestApplication application;
}
+int UtcDaliTouchDataNormalProcessing02(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ actor.SetSize(100.0f, 100.0f);
+ actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(actor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Connect to actor's touched signal
+ HandleData handleData;
+ TouchDataHandleFunctor functor( handleData );
+ actor.TouchSignal().Connect( &application, functor );
+
+ Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 localCoordinates;
+ actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+
+ // Emit a down signal
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
+ DALI_TEST_EQUALS( true, handleData.signalReceived, TEST_LOCATION );
+ DALI_TEST_EQUALS( 1u, handleData.touchData.GetPointCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::DOWN, handleData.touchData.GetState(0), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, handleData.touchData.GetScreenPosition(0), TEST_LOCATION );
+ DALI_TEST_EQUALS( localCoordinates, handleData.touchData.GetLocalPosition(0), 0.1f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
int UtcDaliTouchDataAPINegative(void)
{
TestApplication application;
screenCoordinates.x = screenCoordinates.y = 12.0f;
actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, screenCoordinates ) );
- const TouchPoint *point3 = &data.touchEvent.GetPoint(0);
+
+ const TouchPoint *point3ptr = &data.touchEvent.GetPoint(0);
+ TouchPoint point3( point3ptr->deviceId, point3ptr->state, point3ptr->screen.x, point3ptr->screen.y, point3ptr->local.x, point3ptr->local.y );
+
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Up, point3->state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, point3->screen, TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, point3->local, 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( TouchPoint::Up, point3.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, point3.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( localCoordinates, point3.local, 0.1f, TEST_LOCATION );
data.Reset();
// Emit a down signal where the actor is not present
{
public:
+ struct Property
+ {
+ enum
+ {
+ P1=Dali::PROPERTY_REGISTRATION_START_INDEX,
+ P2
+ };
+ };
+
+
MyTestCustomActor2()
{
}
static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true );
+PropertyRegistration P1( customTypeInit, "propertyOne", MyTestCustomActor2::Property::P1, Property::INTEGER, &SetProperty, &GetProperty );
+PropertyRegistration P2( customTypeInit, "propertyTwo", MyTestCustomActor2::Property::P2, Property::STRING, &SetProperty, &GetProperty );
+
+
+class MyTestCustomActor3 : public CustomActor
+{
+public:
+ MyTestCustomActor3()
+ {
+ }
+
+ static MyTestCustomActor3 New()
+ {
+ return MyTestCustomActor3(); // takes ownership
+ }
+
+ virtual ~MyTestCustomActor3()
+ {
+ }
+
+ static MyTestCustomActor3 DownCast( BaseHandle handle )
+ {
+ MyTestCustomActor3 result;
+
+ CustomActor custom = Dali::CustomActor::DownCast( handle );
+ if ( custom )
+ {
+ CustomActorImpl& customImpl = custom.GetImplementation();
+
+ Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
+
+ if (impl)
+ {
+ result = MyTestCustomActor3(customImpl.GetOwner());
+ }
+ }
+
+ return result;
+ }
+
+private:
+
+ MyTestCustomActor3(Internal::CustomActor* internal)
+ : CustomActor(internal)
+ {
+ }
+
+ MyTestCustomActor3( Impl::MyTestCustomActor& impl )
+ : CustomActor( impl )
+ {
+ }
+};
+
+static TypeRegistration customTypeBadInit( typeid(MyTestCustomActor3), typeid(Dali::CustomActor), NULL, false );
BaseHandle CreateCustom(void)
{
// Check property count of type-info is 1
Property::IndexContainer indices;
typeInfo.GetPropertyIndices( indices );
+
+ size_t typePropertyCount = typeInfo.GetPropertyCount();
DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.Size(), typePropertyCount, TEST_LOCATION );
// Ensure indices returned from actor and customActor differ by two
Actor actor = Actor::New();
END_TEST;
}
+
+
+int UtcDaliTypeInfoGetCreatorP(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
+ DALI_TEST_CHECK( typeInfo );
+
+ TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
+ DALI_TEST_EQUALS( createFn != NULL, true, TEST_LOCATION );
+ if( createFn )
+ {
+ // try calling it:
+ BaseHandle handle = createFn();
+ DALI_TEST_EQUALS( (bool)handle, true, TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliTypeInfoGetCreatorN(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor3" );
+ DALI_TEST_CHECK( typeInfo );
+
+ TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
+ DALI_TEST_EQUALS( createFn == NULL, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTypeInfoGetPropertyCountP1(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
+ DALI_TEST_CHECK( typeInfo );
+ size_t actorPropertyCount = typeInfo.GetPropertyCount();
+
+ DALI_TEST_EQUALS( actorPropertyCount == 0 , true, TEST_LOCATION ); // No event only props
+ END_TEST;
+}
+
+int UtcDaliTypeInfoGetPropertyCountP2(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor2" );
+ DALI_TEST_CHECK( typeInfo );
+ size_t propertyCount = typeInfo.GetPropertyCount();
+ Property::IndexContainer indices;
+ typeInfo.GetPropertyIndices( indices );
+
+ DALI_TEST_EQUALS( propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( propertyCount == 2, true, TEST_LOCATION );
+
+ END_TEST;
+}
@for i in `find $(COVERAGE_DIR) -name "libdali_la-*.gcda" -o -name "libdali_la-*.gcno"` ;\
do mv $$i `echo $$i | sed s/libdali_la-//` ; done
@cd $(COVERAGE_DIR) ; lcov $(LCOV_OPTS) --base-directory . --directory . -c -o dali.info
- @cd $(COVERAGE_DIR) ; lcov $(LCOV_OPTS) --remove dali.info "*/dali-env/*" "/usr/include/*" -o dali.info
+ @cd $(COVERAGE_DIR) ; lcov $(LCOV_OPTS) --remove dali.info "*/dali-env/*" "/usr/include/*" "public-api/shader-effects/*" "*/image-actor*" -o dali.info
+
@test -z $(COVERAGE_OUTPUT_DIR) || mkdir -p $(COVERAGE_OUTPUT_DIR)
coverage: cov_data