Merge changes I555b7cf0,I1be28edf,I605de844,I87caee64 into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 14 Jul 2016 07:07:46 +0000 (00:07 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 14 Jul 2016 07:07:46 +0000 (00:07 -0700)
* changes:
  (Automated Tests) Increase coverage of ScrollBar
  (Automated Tests) Increase coverage of Buttons
  (Automated Tests) Increase coverage of Builder
  (Automated Tests) Increase coverage of ItemView

automated-tests/src/dali-toolkit/utc-Dali-Builder.cpp
automated-tests/src/dali-toolkit/utc-Dali-Button.cpp
automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp
automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp
automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp

index 645863e..2991aae 100644 (file)
 using namespace Dali;
 using namespace Toolkit;
 
+namespace BuilderControlProperty
+{
+
+enum
+{
+  INTEGER_PROPERTY = Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1,
+  MATRIX3_PROPERTY,
+  MATRIX_PROPERTY,
+  NONE_PROPERTY
+};
+
+namespace
+{
+
+BaseHandle Create()
+{
+  return Toolkit::Control::New();
+}
+
+int gSetPropertyCalledCount = 0;
+
+void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
+{
+  ++gSetPropertyCalledCount;
+}
+
+Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+  return Property::Value();
+}
+
+} // unnamed namespace
+
+// Properties
+Dali::TypeRegistration typeRegistration( "BuilderControl", typeid( Toolkit::Control ), Create );
+
+Dali::PropertyRegistration propertyInteger( typeRegistration, "integerProperty", INTEGER_PROPERTY, Property::INTEGER, &SetProperty, &GetProperty );
+Dali::PropertyRegistration propertyMatrix3( typeRegistration, "matrix3Property", MATRIX3_PROPERTY, Property::MATRIX3, &SetProperty, &GetProperty );
+Dali::PropertyRegistration propertyMatrix(  typeRegistration, "matrixProperty",  MATRIX_PROPERTY,  Property::MATRIX,  &SetProperty, &GetProperty );
+Dali::PropertyRegistration propertyNone(    typeRegistration, "noneProperty",    NONE_PROPERTY,    Property::NONE,    &SetProperty, &GetProperty );
+
+}
+
 namespace
 {
 
@@ -844,6 +887,32 @@ int UtcDaliBuilderPropertyNotificationP(void)
       "      \"property\": \"visible\",\n"
       "      \"condition\": \"False\",\n"
       "      \"action\": \"show\"\n"
+      "    },\n"
+      "    {\n"
+      "      \"property\": \"positionX\",\n"
+      "      \"condition\": \"LessThan\",\n"
+      "      \"arg0\": 0.0,\n"
+      "      \"action\": \"show\"\n"
+      "    },\n"
+      "    {\n"
+      "      \"property\": \"positionY\",\n"
+      "      \"condition\": \"GreaterThan\",\n"
+      "      \"arg0\": 200.0,\n"
+      "      \"action\": \"show\"\n"
+      "    },\n"
+      "    {\n"
+      "      \"property\": \"positionZ\",\n"
+      "      \"condition\": \"Inside\",\n"
+      "      \"arg0\": 0.0,\n"
+      "      \"arg1\": 10.0,\n"
+      "      \"action\": \"show\"\n"
+      "    },\n"
+      "    {\n"
+      "      \"property\": \"positionZ\",\n"
+      "      \"condition\": \"Outside\",\n"
+      "      \"arg0\": 40.0,\n"
+      "      \"arg1\": 50.0,\n"
+      "      \"action\": \"show\"\n"
       "    }]\n"
       "  }]\n"
       "}\n"
@@ -881,6 +950,42 @@ int UtcDaliBuilderPropertyNotificationP(void)
   END_TEST;
 }
 
+int UtcDaliBuilderPropertyNotificationN(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+      "{\n"
+      "  \"stage\":\n"
+      "  [{\n"
+      "    \"type\": \"Actor\",\n"
+      "    \"notifications\": [{\n"
+      "      \"property\": \"visible\",\n"
+      "      \"condition\": \"ErrorCondition\",\n"
+      "      \"action\": \"show\"\n"
+      "    }]\n"
+      "  }]\n"
+      "}\n"
+  );
+
+  try
+  {
+    Builder builder = Builder::New();
+    builder.LoadFromString( json );
+    builder.AddActors ( Stage::GetCurrent().GetRootLayer() );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+
+
 int UtcDaliBuilderCustomPropertyP(void)
 {
   ToolkitTestApplication application;
@@ -1295,6 +1400,36 @@ int UtcDaliBuilderPathConstraintsP(void)
     "              \"range\": [-300,300]\n"
     "            }\n"
     "          ]\n"
+    "        },\n"
+    "        {\n"
+    "          \"name\": \"offStage\",\n"
+    "          \"action\": \"removeConstraints\",\n"
+    "          \"constrainer\": \"constrainer0\",\n"
+    "          \"properties\":\n"
+    "          [\n"
+    "            {\n"
+    "              \"source\": \"Image1\",\n"
+    "              \"sourceProperty\": \"positionX\",\n"
+    "              \"target\": \"Image1\",\n"
+    "              \"targetProperty\": \"colorRed\",\n"
+    "              \"range\": [-300,300]\n"
+    "            }\n"
+    "          ]\n"
+    "        },\n"
+    "        {\n"
+    "          \"name\": \"offStage\",\n"
+    "          \"action\": \"removeConstraints\",\n"
+    "          \"constrainer\": \"constrainer1\",\n"
+    "          \"properties\":\n"
+    "          [\n"
+    "            {\n"
+    "              \"source\": \"Image1\",\n"
+    "              \"sourceProperty\": \"positionX\",\n"
+    "              \"target\": \"Image1\",\n"
+    "              \"targetProperty\": \"colorBlue\",\n"
+    "              \"range\": [-300,300]\n"
+    "            }\n"
+    "          ]\n"
     "        }\n"
     "      ]\n"
     "    }\n"
@@ -1411,6 +1546,18 @@ int UtcDaliBuilderPathConstraintsP(void)
   Dali::LinearConstrainer constrainer1_2 = builder.GetLinearConstrainer( "constrainer1" );
   DALI_TEST_CHECK( constrainer1 == constrainer1_2 );
 
+  // For coverage
+
+  Actor actor = Actor::New();
+  Stage::GetCurrent().Add( actor );
+  builder.AddActors( actor );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  actor.GetChildAt( 0 ).Unparent();
+
   END_TEST;
 }
 
@@ -1644,3 +1791,72 @@ int UtcDaliBuilderTypeCasts(void)
 
   END_TEST;
 }
+
+int UtcDaliBuilderBuilderControl(void)
+{
+  ToolkitTestApplication application;
+
+  std::string json(
+    "{"
+       "\"stage\":"
+       "[{"
+         "\"type\": \"BuilderControl\","
+         "\"integerProperty\": 10,"
+         "\"matrix3Property\": [ 1,2,3,4,5,6,7,8,9 ],"
+         "\"matrixProperty\":  [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ],"
+         "\"noneProperty\": 10"
+      "}]"
+    "}"
+  );
+
+  Actor rootActor = Actor::New();
+  Stage::GetCurrent().Add( rootActor );
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+  builder.AddActors( rootActor );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( BuilderControlProperty::gSetPropertyCalledCount, 4, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliBuilderActionsWithParams(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+      "{\n"
+      "\"stage\":\n"
+      "[\n"
+      "  { \n"
+      "    \"type\": \"ImageView\",\n"
+      "    \"name\": \"image\",\n"
+      "    \"size\": [100,100,1],\n"
+      "    \"signals\": [{\n"
+      "      \"name\": \"touch\",\n"
+      "      \"action\": \"show\",\n"
+      "      \"parameters\": {\n"
+      "        \"property1\" : 10,\n"
+      "        \"property2\" : [1,2],\n"
+      "        \"property3\" : [1,2,3],\n"
+      "        \"property4\" : [1,2,3,4]\n"
+      "      }\n"
+      "    }]\n"
+      "  }\n"
+      "]\n"
+      "}\n"
+  );
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+  builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+
+  DALI_TEST_CHECK( true ); // For Coverage
+
+  END_TEST;
+}
index 80a8f70..b5ec1f1 100644 (file)
@@ -707,3 +707,237 @@ int UtcDaliButtonSize(void)
   DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
   END_TEST;
 }
+
+int UtcDaliButtonSetSelectedBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetSelectedBackgroundImage( "TestImage.jpg");
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetSelectedBackgroundImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetSelectedBackgroundImage( "TestImage.jpg");
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetDisabledImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetDisabledImage( "TestImage.jpg");
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetDisabledImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetDisabledImage( "TestImage.jpg");
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetDisabledSelectedImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetDisabledSelectedImage( "TestImage.jpg");
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetDisabledSelectedImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetDisabledSelectedImage( "TestImage.jpg");
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetLabelP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetLabel( TextLabel::New("Hello") );
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetLabelN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetLabel( TextLabel::New("Hello") );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetButtonImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetButtonImage( CreateBufferImage( 10, 10, Color::WHITE ) );
+    DALI_TEST_CHECK( ImageView::DownCast( button.GetButtonImage() ) );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetButtonImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetButtonImage( CreateBufferImage( 10, 10, Color::WHITE ) );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetSelectedImageWithImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetSelectedImage( CreateBufferImage( 10, 10, Color::WHITE ) );
+    DALI_TEST_CHECK( ImageView::DownCast( button.GetSelectedImage() ) );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliButtonSetSelectedImageWithImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetSelectedImage( CreateBufferImage( 10, 10, Color::WHITE ) );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
index 8be97fe..d5c6af5 100644 (file)
@@ -345,6 +345,7 @@ int UtcDaliItemViewDeactivateCurrentLayout(void)
 
   // Create a grid layout and add it to ItemView
   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  gridLayout->SetOrientation(ControlOrientation::Down);
   view.AddLayout(*gridLayout);
 
   // Check there is no active layout at the moment
@@ -375,6 +376,7 @@ int UtcDaliItemViewGetItemAndGetItemId(void)
 
   // Create a grid layout and add it to ItemView
   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  gridLayout->SetOrientation(ControlOrientation::Left);
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
@@ -399,6 +401,7 @@ int UtcDaliItemViewRemoveItem(void)
 
   // Create a grid layout and add it to ItemView
   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  gridLayout->SetOrientation(ControlOrientation::Right);
   view.AddLayout(*gridLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
@@ -430,9 +433,10 @@ int UtcDaliItemViewGetCurrentLayoutPosition(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a depth layout and add it to ItemView
+  ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
+  depthLayout->SetOrientation(ControlOrientation::Up);
+  view.AddLayout(*depthLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -533,14 +537,14 @@ int UtcDaliItemViewScrollToItem(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
   Vector3 vec(480.0f, 800.0f, 0.0f);
-  ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+  ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
 
   view.SetName("view actor");
   view.AddLayout(*layout);
   view.SetSize(vec);
 
   Stage::GetCurrent().Add(view);
-  layout->SetOrientation(ControlOrientation::Up);
+  layout->SetOrientation(ControlOrientation::Down);
   view.ActivateLayout(0, vec, 0.0f);
 
   application.SendNotification();
@@ -624,9 +628,10 @@ int UtcDaliItemViewInsertItemP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a depth layout and add it to ItemView
+  ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
+  depthLayout->SetOrientation(ControlOrientation::Left);
+  view.AddLayout(*depthLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -656,9 +661,10 @@ int UtcDaliItemViewInsertItemsP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a depth layout and add it to ItemView
+  ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
+  depthLayout->SetOrientation(ControlOrientation::Right);
+  view.AddLayout(*depthLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -712,9 +718,9 @@ int UtcDaliItemViewReplaceItemP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a spiral layout and add it to ItemView
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -736,9 +742,10 @@ int UtcDaliItemViewReplaceItemsP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a spiral layout and add it to ItemView
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  spiralLayout->SetOrientation( ControlOrientation::Down );
+  view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -773,9 +780,10 @@ int UtcDaliItemViewGetItemsRangeP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a spiral layout and add it to ItemView
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  spiralLayout->SetOrientation( ControlOrientation::Left );
+  view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
@@ -797,9 +805,10 @@ int UtcDaliItemViewSetItemsAnchorPointP(void)
   TestItemFactory factory;
   ItemView view = ItemView::New(factory);
 
-  // Create a grid layout and add it to ItemView
-  ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
-  view.AddLayout(*gridLayout);
+  // Create a spiral layout and add it to ItemView
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  spiralLayout->SetOrientation( ControlOrientation::Right );
+  view.AddLayout(*spiralLayout);
 
   // Activate the grid layout so that the items will be created and added to ItemView
   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
index fe2ac1d..82d6a40 100644 (file)
@@ -928,3 +928,276 @@ int UtcDaliPushButtonAlignmentLayout(void)
 
   END_TEST;
 }
+
+int UtcDaliPushButtonSetButtonImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetButtonImage( ImageView::New() );
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetButtonImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetSelectedImage( ImageView::New() );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetBackgroundImage( ImageView::New() );
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetBackgroundImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetBackgroundImage( ImageView::New() );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetSelectedImage( ImageView::New() );
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetSelectedImage( ImageView::New() );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetSelectedBackgroundImage( ImageView::New() );
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedBackgroundImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetSelectedBackgroundImage( ImageView::New() );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetDisabledBackgroundImage( ImageView::New() );
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledBackgroundImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetDisabledBackgroundImage( ImageView::New() );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetDisabledImage( ImageView::New() );
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetDisabledImage( ImageView::New() );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledSelectedImageP(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button = PushButton::New();
+  Stage::GetCurrent().Add( button );
+
+  try
+  {
+    button.SetDisabledSelectedImage( ImageView::New() );
+    DALI_TEST_CHECK( true );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledSelectedImageN(void)
+{
+  ToolkitTestApplication application;
+
+  PushButton button;
+
+  try
+  {
+    button.SetDisabledSelectedImage( ImageView::New() );
+    DALI_TEST_CHECK( false );
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
index ff4f5b9..ea50a30 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <iostream>
 #include <stdlib.h>
+#include <string>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/integration-api/events/pan-gesture-event.h>
@@ -117,6 +118,20 @@ static void OnPanFinished()
   gOnPanFinishedCalled = true;
 }
 
+struct CallbackFunctor
+{
+  CallbackFunctor(bool* callbackFlag)
+  : mCallbackFlag( callbackFlag )
+  {
+  }
+
+  void operator()()
+  {
+    *mCallbackFlag = true;
+  }
+  bool* mCallbackFlag;
+};
+
 /**
  * Invoked when the current scroll position of the scrollable content goes above or below the values
  * specified by SCROLL_POSITION_INTERVALS property.
@@ -212,9 +227,47 @@ int UtcDaliToolkitScrollBarNewP(void)
   DALI_TEST_CHECK( vertical );
   DALI_TEST_CHECK( vertical.GetScrollDirection() == ScrollBar::Vertical );
 
+  Property::Value value = vertical.GetProperty(ScrollBar::Property::SCROLL_DIRECTION);
+  std::string scrollDirection = value.Get<std::string>();
+  DALI_TEST_EQUALS( scrollDirection, "Vertical", TEST_LOCATION );
+
   ScrollBar horizontal = ScrollBar::New(ScrollBar::Horizontal);
   DALI_TEST_CHECK( horizontal );
   DALI_TEST_CHECK( horizontal.GetScrollDirection() == ScrollBar::Horizontal );
+  value = vertical.GetProperty(ScrollBar::Property::SCROLL_DIRECTION);
+  scrollDirection = value.Get<std::string>();
+  DALI_TEST_EQUALS( scrollDirection, "Horizontal", TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliToolkitScrollBarCreateP(void)
+{
+  ToolkitTestApplication application;
+
+  TypeRegistry typeRegistry = TypeRegistry::Get();
+  DALI_TEST_CHECK( typeRegistry );
+
+  TypeInfo typeInfo = typeRegistry.GetTypeInfo( "ScrollBar" );
+  DALI_TEST_CHECK( typeInfo );
+
+  BaseHandle handle = typeInfo.CreateInstance();
+  DALI_TEST_CHECK( handle );
+
+  ScrollBar scrollBar = ScrollBar::DownCast( handle );
+  DALI_TEST_CHECK( scrollBar );
+
+  scrollBar.SetProperty(ScrollBar::Property::SCROLL_DIRECTION, "Vertical");
+  scrollBar.SetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY, "Fixed");
+
+  DALI_TEST_EQUALS( scrollBar.GetScrollDirection(), Toolkit::ScrollBar::Vertical, TEST_LOCATION );
+  DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Fixed, TEST_LOCATION );
+
+  scrollBar.SetProperty(ScrollBar::Property::SCROLL_DIRECTION, "Horizontal");
+  scrollBar.SetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY, "Variable");
+
+  DALI_TEST_EQUALS( scrollBar.GetScrollDirection(), Toolkit::ScrollBar::Horizontal, TEST_LOCATION );
+  DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Variable, TEST_LOCATION );
 
   END_TEST;
 }
@@ -704,6 +757,9 @@ int UtcDaliToolkitScrollBarSetIndicatorHeightPolicyP(void)
   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
   scrollBar.SetIndicatorFixedHeight(50.0f);
 
+  Property::Value value = scrollBar.GetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY);
+  DALI_TEST_EQUALS(value.Get<std::string>(), "Fixed", TEST_LOCATION );
+
   // Render and notify
   application.SendNotification();
   application.Render();
@@ -714,6 +770,8 @@ int UtcDaliToolkitScrollBarSetIndicatorHeightPolicyP(void)
 
   // Set the indicator height to be variable
   scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Variable);
+  value = scrollBar.GetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY);
+  DALI_TEST_EQUALS(value.Get<std::string>(), "Variable", TEST_LOCATION );
 
   // Render and notify
   application.SendNotification();
@@ -1344,7 +1402,10 @@ int UtcDaliToolkitScrollBarPanFinishedSignalP(void)
   Stage::GetCurrent().Add( scrollBar );
 
   // Connect the pan finished signal
+  ConnectionTracker connectionTracker;
+  bool panFinished = false;
   scrollBar.PanFinishedSignal().Connect( &OnPanFinished );
+  scrollBar.ConnectSignal( &connectionTracker, "panFinished", CallbackFunctor(&panFinished));
 
   // Render and notify
   application.SendNotification();
@@ -1375,6 +1436,7 @@ int UtcDaliToolkitScrollBarPanFinishedSignalP(void)
   // Perform a swipe gesture on the indicator
   PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
   DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION );
+  DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -1398,7 +1460,10 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void)
   Stage::GetCurrent().Add( scrollBar );
 
   // Connect the pan finished signal
+  ConnectionTracker connectionTracker;
+  bool panFinished = false;
   scrollBar.PanFinishedSignal().Connect( &OnPanFinished );
+  scrollBar.ConnectSignal( &connectionTracker, "panFinished", CallbackFunctor(&panFinished));
 
   // Render and notify
   application.SendNotification();
@@ -1433,10 +1498,12 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void)
   // Perform a swipe gesture on the scroll bar but not on the indicator
   PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20);
   DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( panFinished, false, TEST_LOCATION );
 
   // Perform a swipe gesture on the indicator
   PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
   DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION );
+  DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -1454,9 +1521,12 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void)
   scrollBar.SetSize(20.0f, 800.0f, 0.0f);
 
   Stage::GetCurrent().Add( scrollBar );
+  ConnectionTracker connectionTracker;
 
   // Connect to the ScrollPositionIntervalReached signal
+  bool intervalReached = false;
   scrollBar.ScrollPositionIntervalReachedSignal().Connect( &OnScrollPositionIntervalReached );
+  scrollBar.ConnectSignal( &connectionTracker, "scrollPositionIntervalReached", CallbackFunctor(&intervalReached));
 
   // Render and notify
   application.SendNotification();
@@ -1509,9 +1579,11 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void)
 
   // Check that the signal callback is called
   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
+  DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
 
   // Reset the flag
   gOnScrollPositionIntervalReachedSignalCalled = false;
+  intervalReached = false;
 
   // Rest and clear the animation
   animation.Clear();
@@ -1527,9 +1599,11 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void)
 
   // Check that the signal callback is called
   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
+  DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
 
   // Reset the flag
   gOnScrollPositionIntervalReachedSignalCalled = false;
+  intervalReached = false;
 
   // Rest and clear the animation
   animation.Clear();
@@ -1545,6 +1619,7 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalP(void)
 
   // Check that the signal callback is called
   DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
+  DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -1635,5 +1710,3 @@ int UtcDaliToolkitScrollBarScrollPositionIntervalReachedSignalN(void)
 
   END_TEST;
 }
-
-