[3.0] Added test cases for public api. 25/79325/2
authorDavid Steele <david.steele@samsung.com>
Mon, 4 Jul 2016 18:42:12 +0000 (19:42 +0100)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 11 Jul 2016 04:22:57 +0000 (21:22 -0700)
Coverage of public API methods showed that some methods had no
test cases. Have added test cases for all relevant methods.

Reminder: No C++ method coverage can be 100% complete ( compiler
generated virtual destructors cannot always be called ).

Change-Id: Ia3dc12b5e8262ea1e20c17141378d2a2f3c91b8e
Signed-off-by: David Steele <david.steele@samsung.com>
15 files changed:
automated-tests/execute.sh
automated-tests/src/dali-devel/utc-Dali-Actor.cpp
automated-tests/src/dali/dali-test-suite-utils/test-native-image.cpp
automated-tests/src/dali/dali-test-suite-utils/test-native-image.h
automated-tests/src/dali/utc-Dali-BaseHandle.cpp
automated-tests/src/dali/utc-Dali-EncodedBufferImage.cpp
automated-tests/src/dali/utc-Dali-IntrusivePtr.cpp
automated-tests/src/dali/utc-Dali-NativeImage.cpp
automated-tests/src/dali/utc-Dali-NinePatchImages.cpp
automated-tests/src/dali/utc-Dali-PropertyMap.cpp
automated-tests/src/dali/utc-Dali-Stage.cpp
automated-tests/src/dali/utc-Dali-TouchDataProcessing.cpp
automated-tests/src/dali/utc-Dali-TouchProcessing.cpp
automated-tests/src/dali/utc-Dali-TypeRegistry.cpp
build/tizen/Makefile.am

index 7d430c9..4ce6fda 100755 (executable)
@@ -134,9 +134,15 @@ else
             output=`build/src/$mod/tct-$mod-core $1`
             ret=$?
             if [ $ret -ne 6 ] ; then
-               echo $output
-               if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
-               exit $ret
+                if [ $opt_debug -ne 0 ] ; then
+                    echo DEBUGGING:
+                    gdb --args build/src/$mod/tct-$mod-core $1
+
+                else
+                    echo $output
+                    if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
+                fi
+                exit $ret
             fi
         done
         echo $1 not found
index 2dab3f2..da30c62 100644 (file)
@@ -106,7 +106,31 @@ int UtcDaliActorAddRendererOnStage(void)
   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;
@@ -129,3 +153,28 @@ int UtcDaliActorRemoveRendererP(void)
 
   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;
+}
index 135476e..3afe935 100644 (file)
@@ -38,4 +38,19 @@ TestNativeImage::~TestNativeImage()
 {
 }
 
+
+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
index f361280..7724717 100644 (file)
@@ -25,7 +25,9 @@
 namespace Dali
 {
 class TestNativeImage;
+class TestNativeImageNoExt;
 typedef IntrusivePtr<TestNativeImage> TestNativeImagePointer;
+typedef IntrusivePtr<TestNativeImageNoExt> TestNativeImageNoExtPointer;
 
 class DALI_IMPORT_API TestNativeImageExtension: public Dali::NativeImageInterface::Extension
 {
@@ -65,6 +67,34 @@ public:
   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
index bb64130..865fa5b 100644 (file)
@@ -123,7 +123,6 @@ int UtcDaliBaseHandleConstructorVoid(void)
   END_TEST;
 }
 
-
 int UtcDaliBaseHandleCopyConstructor(void)
 {
   TestApplication application;
index 70e6c50..8586b61 100644 (file)
@@ -799,7 +799,7 @@ int UtcDaliEncodedBufferImageDownCastP(void)
 }
 
 // Positive test case for constructors:
-int UtcDaliEncodedBufferImageNew01(void)
+int UtcDaliEncodedBufferImageNewP1(void)
 {
   TestApplication application;
 
@@ -827,8 +827,35 @@ int UtcDaliEncodedBufferImageNew01(void)
   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;
 
@@ -855,7 +882,7 @@ int UtcDaliEncodedBufferImageNew02(void)
 }
 
 // Negative test case for constructor - zero-length input buffer:
-int UtcDaliEncodedBufferImageNew03(void)
+int UtcDaliEncodedBufferImageNewN2(void)
 {
   TestApplication application;
 
index 23c7880..ff22fb7 100644 (file)
@@ -73,7 +73,33 @@ public:
     ++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.
@@ -459,3 +485,49 @@ int UtcDaliIntrusivePtrOperatorNotEqualLeftPointerTU(void)
   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;
+}
index 2b59b92..e143837 100644 (file)
@@ -207,9 +207,12 @@ int UtcDaliNativeImageExtensionP(void)
 
   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;
 }
 
index 8885918..97f4ee3 100644 (file)
@@ -263,6 +263,9 @@ int UtcDaliNinePatchImageGetStrechBorders(void)
 
      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
    {
index f9cae36..bb17787 100644 (file)
@@ -199,7 +199,8 @@ int UtcDaliPropertyMapFind(void)
   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 );
 
@@ -207,16 +208,41 @@ int UtcDaliPropertyMapFind(void)
   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;
index 7611ad2..10496fd 100644 (file)
@@ -109,10 +109,13 @@ struct TouchedSignalData
 
     receivedTouchEvent.points.clear();
     receivedTouchEvent.time = 0;
+
+    receivedTouchData.Reset();
   }
 
   bool functorCalled;
   TouchEvent receivedTouchEvent;
+  TouchData receivedTouchData;
 };
 
 // Functor that sets the data when touched signal is received
@@ -129,6 +132,21 @@ struct TouchedFunctor
   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
 {
@@ -1081,6 +1099,208 @@ int UtcDaliStageTouchedSignalN(void)
   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;
@@ -1319,3 +1539,15 @@ int UtcDaliStageGetObjectRegistryN(void)
 
   END_TEST;
 }
+
+int UtcDaliStageOperatorAssign(void)
+{
+  TestApplication app;
+  Stage stage;
+  DALI_TEST_CHECK( !stage );
+
+  stage = Stage::GetCurrent();
+  DALI_TEST_CHECK( stage );
+
+  END_TEST;
+}
index 48b6625..36e8488 100644 (file)
@@ -149,6 +149,43 @@ struct TouchDataFunctor
   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
 {
@@ -252,7 +289,7 @@ Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vecto
 
 ///////////////////////////////////////////////////////////////////////////////
 
-int UtcDaliTouchDataNormalProcessing(void)
+int UtcDaliTouchDataNormalProcessing01(void)
 {
   TestApplication application;
 
@@ -316,6 +353,40 @@ int UtcDaliTouchDataNormalProcessing(void)
 }
 
 
+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;
index 62052ed..998b8ec 100644 (file)
@@ -179,12 +179,15 @@ int UtcDaliTouchNormalProcessing(void)
   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
index de9d773..d38de86 100644 (file)
@@ -356,6 +356,16 @@ class MyTestCustomActor2 : public CustomActor
 {
 public:
 
+  struct Property
+  {
+    enum
+    {
+      P1=Dali::PROPERTY_REGISTRATION_START_INDEX,
+      P2
+    };
+  };
+
+
   MyTestCustomActor2()
   {
   }
@@ -404,6 +414,60 @@ private:
 
 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)
 {
@@ -976,7 +1040,10 @@ int UtcDaliTypeRegistryPropertyRegistrationP(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();
@@ -2077,3 +2144,68 @@ int UtcDaliTypeInfoGetSignalNameN(void)
 
   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;
+}
index c1296f3..925f052 100644 (file)
@@ -49,7 +49,8 @@ cov_data:
        @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