Add utc test cases 55/39855/1
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 25 May 2015 08:02:25 +0000 (17:02 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Mon, 25 May 2015 08:02:25 +0000 (17:02 +0900)
Change-Id: I304442fbcbc4930b760920809e09e4f859645b47

automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h
automated-tests/src/dali-toolkit/utc-Dali-Button.cpp
automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp
automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp
automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.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-RadioButton.cpp

index 8d2734b..7d1ef18 100644 (file)
@@ -313,6 +313,22 @@ static bool TestCallback(Actor actor, const TouchEvent& event)
 
 //////////////////////////////////////////////////////////
 
 
 //////////////////////////////////////////////////////////
 
+int UtcDaliPushButtonDownCast(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonDownCast");
+
+  TETButton tetButton= Toolkit::TETButton::New();
+
+  BaseHandle object(tetButton);
+
+  TETButton tetButton2 = TETButton::DownCast( object );
+  DALI_TEST_CHECK(tetButton2);
+
+  TETButton tetButton3 = DownCast< TETButton >(object);
+  DALI_TEST_CHECK(tetButton3);
+  END_TEST;
+}
 
 int UtcDaliPushButtonInterruptEventWhenInsensitive(void)
 {
 
 int UtcDaliPushButtonInterruptEventWhenInsensitive(void)
 {
index 0d9059d..e6f1b50 100644 (file)
@@ -64,7 +64,7 @@ DummyControl DummyControlImpl::New()
 }
 
 DummyControlImpl::DummyControlImpl()
 }
 
 DummyControlImpl::DummyControlImpl()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_HOVER_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mCustomSlot1Called(false)
 {
 }
   mCustomSlot1Called(false)
 {
 }
@@ -86,6 +86,7 @@ DummyControl DummyControlImplOverride::New()
 DummyControlImplOverride::DummyControlImplOverride()
 : DummyControlImpl(),
   initializeCalled(false),
 DummyControlImplOverride::DummyControlImplOverride()
 : DummyControlImpl(),
   initializeCalled(false),
+  activatedCalled(false),
   themeChangeCalled( false ),
   fontChangeCalled( false ),
   pinchCalled(false),
   themeChangeCalled( false ),
   fontChangeCalled( false ),
   pinchCalled(false),
@@ -99,6 +100,7 @@ DummyControlImplOverride::DummyControlImplOverride()
   sizeSetCalled(false),
   sizeAnimationCalled(false),
   touchEventCalled(false),
   sizeSetCalled(false),
   sizeAnimationCalled(false),
   touchEventCalled(false),
+  hoverEventCalled(false),
   mouseWheelEventCalled(false),
   keyEventCalled(false),
   keyInputFocusGained(false),
   mouseWheelEventCalled(false),
   keyEventCalled(false),
   keyInputFocusGained(false),
@@ -110,6 +112,7 @@ DummyControlImplOverride::~DummyControlImplOverride() { }
 
 
 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
 
 
 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
+void DummyControlImplOverride::OnActivated() { activatedCalled = true; }
 void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
 {
   themeChangeCalled = change == StyleChange::THEME_CHANGE;
 void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
 {
   themeChangeCalled = change == StyleChange::THEME_CHANGE;
@@ -126,6 +129,7 @@ void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled =
 void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; }
 void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; }
 bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
 void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; }
 void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; }
 bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
+bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
 bool DummyControlImplOverride::OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; }
 bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
 void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
 bool DummyControlImplOverride::OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; }
 bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
 void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
index 19dc1fe..7791006 100644 (file)
@@ -102,6 +102,7 @@ private:
 private: // From Internal::Control
 
   virtual void OnInitialize();
 private: // From Internal::Control
 
   virtual void OnInitialize();
+  virtual void OnActivated();
   virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
   virtual void OnPinch(const PinchGesture& pinch);
   virtual void OnPan(const PanGesture& pan);
   virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
   virtual void OnPinch(const PinchGesture& pinch);
   virtual void OnPan(const PanGesture& pan);
@@ -117,6 +118,7 @@ private: // From CustomActorImpl
   virtual void OnSizeSet(const Vector3& targetSize);
   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
   virtual bool OnTouchEvent(const TouchEvent& event);
   virtual void OnSizeSet(const Vector3& targetSize);
   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
   virtual bool OnTouchEvent(const TouchEvent& event);
+  virtual bool OnHoverEvent(const HoverEvent& event);
   virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
   virtual bool OnKeyEvent(const KeyEvent& event);
   virtual void OnKeyInputFocusGained();
   virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
   virtual bool OnKeyEvent(const KeyEvent& event);
   virtual void OnKeyInputFocusGained();
@@ -125,6 +127,7 @@ private: // From CustomActorImpl
 public:
 
   bool initializeCalled;
 public:
 
   bool initializeCalled;
+  bool activatedCalled;
   bool themeChangeCalled;
   bool fontChangeCalled;
   bool pinchCalled;
   bool themeChangeCalled;
   bool fontChangeCalled;
   bool pinchCalled;
@@ -138,6 +141,7 @@ public:
   bool sizeSetCalled;
   bool sizeAnimationCalled;
   bool touchEventCalled;
   bool sizeSetCalled;
   bool sizeAnimationCalled;
   bool touchEventCalled;
+  bool hoverEventCalled;
   bool mouseWheelEventCalled;
   bool keyEventCalled;
   bool keyInputFocusGained;
   bool mouseWheelEventCalled;
   bool keyEventCalled;
   bool keyInputFocusGained;
index 12e85b6..5127cfb 100644 (file)
@@ -42,11 +42,11 @@ void utc_dali_toolkit_button_cleanup(void)
 
 namespace
 {
 
 namespace
 {
-static bool gButtonClicked = false;
+static bool gIsCalledButtonCallback = false;
 
 
-static bool ButtonClicked( Button button )
+static bool ButtonCallback( Button button )
 {
 {
-  gButtonClicked = true;
+  gIsCalledButtonCallback = true;
   return false;
 }
 
   return false;
 }
 
@@ -60,159 +60,318 @@ const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 );
 static float ANIMATION_TIME( 0.5f );
 } // namespace
 
 static float ANIMATION_TIME( 0.5f );
 } // namespace
 
+int UtcDaliButtonConstructorP(void)
+{
+  TestApplication application;
+
+  Button button;
+
+  DALI_TEST_CHECK( !button );
+  END_TEST;
+}
+
+int UtcDaliButtonCopyConstructorP(void)
+{
+  TestApplication application;
+
+  // Initialize an object, ref count == 1
+  Button button = PushButton::New();
+
+  Button copy( button );
+  DALI_TEST_CHECK( copy );
+  END_TEST;
+}
+
+int UtcDaliButtonAssignmentOperatorP(void)
+{
+  TestApplication application;
+
+  Button button = PushButton::New();
+
+  Button copy( button );
+  DALI_TEST_CHECK( copy );
+
+  DALI_TEST_CHECK( button == copy );
+  END_TEST;
+}
+
+int UtcDaliButtonDownCastP(void)
+{
+  TestApplication application;
+
+  Button button = PushButton::New();
+
+  BaseHandle object(button);
+
+  Button button2 = Button::DownCast( object );
+  DALI_TEST_CHECK(button2);
+
+  Button button3 = DownCast< Button >(object);
+  DALI_TEST_CHECK(button3);
+  END_TEST;
+}
+
+int UtcDaliButtonDownCastN(void)
+{
+  TestApplication application;
+
+  BaseHandle unInitializedObject;
 
 
+  Button button1 = Button::DownCast( unInitializedObject );
+  DALI_TEST_CHECK( !button1 );
 
 
-// Positive test case for a method
-int UtcDaliButtonNew(void)
+  Button button2 = DownCast< Button >( unInitializedObject );
+  DALI_TEST_CHECK( !button2 );
+  END_TEST;
+}
+
+int UtcDaliButtonSetDisabledP(void)
 {
   ToolkitTestApplication application;
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonNew");
 
 
-  PushButton pushButton = PushButton::New();
+  Button button = PushButton::New();
 
 
-  DALI_TEST_CHECK( pushButton );
+  button.SetDisabled( true );
 
 
-  PushButton pushButton2( pushButton );
+  DALI_TEST_CHECK( button.IsDisabled() );
 
 
-  DALI_TEST_CHECK( pushButton2 );
+  button.SetDisabled( false );
 
 
-  pushButton2.Reset();
+  DALI_TEST_CHECK( !button.IsDisabled() );
 
 
-  // Test down cast
-  Handle handleButton;
-  handleButton = pushButton;
-  Button downCastPushButton = Button::DownCast( handleButton );
-  DALI_TEST_CHECK( downCastPushButton );
-  PushButton downCastPushButton2 = PushButton::DownCast( handleButton );
-  DALI_TEST_CHECK( downCastPushButton2 );
+  button.SetDisabled( true );
 
 
+  DALI_TEST_CHECK( button.IsDisabled() );
+
+  button.SetDisabled( false );
+
+  DALI_TEST_CHECK( !button.IsDisabled() );
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliButtonSetProperty(void)
+int UtcDaliButtonIsDisabledP(void)
 {
 {
-  tet_infoline("UtcDaliButtonSetProperty: ");
   ToolkitTestApplication application;
 
   ToolkitTestApplication application;
 
-  PushButton pushButton = PushButton::New();
+  Button button = PushButton::New();
 
 
-  pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), false);
-  DALI_TEST_CHECK( false == pushButton.IsDisabled() );
-  pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), true);
-  DALI_TEST_CHECK( true == pushButton.IsDisabled() );
+  button.SetDisabled( true );
+
+  DALI_TEST_CHECK( button.IsDisabled() );
+
+  button.SetDisabled( false );
+
+  DALI_TEST_CHECK( !button.IsDisabled() );
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliButtonSetGetDimmed(void)
+int UtcDaliButtonSetAutoRepeatingP(void)
 {
   ToolkitTestApplication application;
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetGetDimmed");
 
 
-  PushButton pushButton = PushButton::New();
+  Button button = PushButton::New();
 
 
-  pushButton.SetDisabled( true );
+  button.SetAutoRepeating( true );
 
 
-  DALI_TEST_CHECK( pushButton.IsDisabled() );
+  DALI_TEST_CHECK( button.IsAutoRepeating() );
 
 
-  pushButton.SetDisabled( false );
+  button.SetAutoRepeating( false );
 
 
-  DALI_TEST_CHECK( !pushButton.IsDisabled() );
+  DALI_TEST_CHECK( !button.IsAutoRepeating() );
 
 
-  pushButton.SetDisabled( true );
+  button.SetAutoRepeating( true );
 
 
-  DALI_TEST_CHECK( pushButton.IsDisabled() );
+  DALI_TEST_CHECK( button.IsAutoRepeating() );
 
 
-  pushButton.SetDisabled( false );
+  button.SetAutoRepeating( false );
 
 
-  DALI_TEST_CHECK( !pushButton.IsDisabled() );
+  DALI_TEST_CHECK( !button.IsAutoRepeating() );
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliButtonSize(void)
+int UtcDaliButtonIsAutoRepeatingP(void)
 {
   ToolkitTestApplication application;
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSize");
 
 
-  ImageActor image01 = ImageActor::New(CreateBufferImage());
-  image01.SetSize( 100, 50 );
+  Button button = PushButton::New();
 
 
-  PushButton pushButton;
+  button.SetAutoRepeating( true );
 
 
-  Vector3 size;
+  DALI_TEST_CHECK( button.IsAutoRepeating() );
 
 
-  // Test1 Size is set through Actor API
+  button.SetAutoRepeating( false );
 
 
-  // First an image is set, then SetSize is called.
-  pushButton = PushButton::New();
-  Stage::GetCurrent().Add( pushButton );
+  DALI_TEST_CHECK( !button.IsAutoRepeating() );
+  END_TEST;
+}
 
 
-  pushButton.SetBackgroundImage( image01 );
-  pushButton.SetSize( 10.f, 10.f );
+int UtcDaliButtonSetInitialAutoRepeatingDelayP(void)
+{
+  ToolkitTestApplication application;
 
 
-  application.SendNotification();
-  application.Render();
+  Button button = PushButton::New();
 
 
-  size = pushButton.GetCurrentSize();
+  button.SetInitialAutoRepeatingDelay( 0.5f );
 
 
-  DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
-  DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+  DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
+
+  button.SetInitialAutoRepeatingDelay( 0.2f );
+
+  DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliButtonClicked(void)
+int UtcDaliButtonSetNextAutoRepeatingDelayP(void)
 {
   ToolkitTestApplication application;
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonClicked");
 
 
-  PushButton pushButton = PushButton::New();
-  pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
-  pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
-  pushButton.SetPosition( 240, 400 );
-  pushButton.SetSize( 100, 100 );
+  Button button = PushButton::New();
 
 
-  Stage::GetCurrent().Add( pushButton );
+  button.SetNextAutoRepeatingDelay( 0.5f );
+
+  DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
+
+  button.SetNextAutoRepeatingDelay( 0.2f );
+
+  DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliButtonSetTogglableButtonP(void)
+{
+  ToolkitTestApplication application;
+
+  Button button = PushButton::New();
+
+  button.SetTogglableButton( true );
+
+  DALI_TEST_CHECK( button.IsTogglableButton() );
+
+  button.SetTogglableButton( false );
+
+  DALI_TEST_CHECK( !button.IsTogglableButton() );
+  END_TEST;
+}
+
+int UtcDaliButtonSetSelectedP(void)
+{
+  ToolkitTestApplication application;
+
+  Button button = PushButton::New();
+  button.SetTogglableButton( true );
+
+  button.SetSelected( true );
+
+  DALI_TEST_CHECK( button.IsSelected() );
+
+  button.SetSelected( false );
+
+  DALI_TEST_CHECK( !button.IsSelected() );
+  END_TEST;
+}
+
+int UtcDaliButtonSetAnimationTimeP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliButtonSetAnimationTimeP");
+
+  Button button = PushButton::New();
+
+  button.SetAnimationTime( ANIMATION_TIME );
+
+  DALI_TEST_EQUALS( button.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliButtonSetLabelStringP(void)
+{
+  ToolkitTestApplication application;
+
+  Button button = PushButton::New();
+
+  button.SetLabel( "Button Label" );
+
+  DALI_TEST_CHECK( button.GetLabel() );
+  END_TEST;
+}
+
+int UtcDaliButtonSetLabelActorP(void)
+{
+  ToolkitTestApplication application;
+
+  Button button = PushButton::New();
+
+  TextLabel textLabel = TextLabel::New( "Button Label" );
+  button.SetLabel( textLabel );
+
+  DALI_TEST_CHECK( button.GetLabel() );
+  END_TEST;
+}
+
+int UtcDaliButtonPressedSignalP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliButtonPressedSignalP");
+
+  Button button = PushButton::New();
+  button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  button.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  button.SetPosition( 240, 400 );
+  button.SetSize( 100, 100 );
+
+  Stage::GetCurrent().Add( button );
 
   application.SendNotification();
   application.Render();
 
   // connect to its touch signal
 
   application.SendNotification();
   application.Render();
 
   // connect to its touch signal
-  pushButton.ClickedSignal().Connect( &ButtonClicked );
+  button.PressedSignal().Connect( &ButtonCallback );
+  button.ReleasedSignal().Connect( &ButtonCallback );
 
   Dali::Integration::TouchEvent event;
 
   // Test1. Touch point down and up inside the button.
 
 
   Dali::Integration::TouchEvent event;
 
   // Test1. Touch point down and up inside the button.
 
-  gButtonClicked = false;
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownInside );
   application.ProcessEvent( event );
 
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownInside );
   application.ProcessEvent( event );
 
+  DALI_TEST_CHECK( gIsCalledButtonCallback );
+
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointUpInside );
   application.ProcessEvent( event );
 
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointUpInside );
   application.ProcessEvent( event );
 
-  DALI_TEST_CHECK( gButtonClicked );
+  DALI_TEST_CHECK( gIsCalledButtonCallback );
 
   // Test2. Touch point down and up outside the button.
 
 
   // Test2. Touch point down and up outside the button.
 
-  gButtonClicked = false;
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownOutside );
   application.ProcessEvent( event );
 
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownOutside );
   application.ProcessEvent( event );
 
+  DALI_TEST_CHECK( !gIsCalledButtonCallback );
+
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointUpOutside );
   application.ProcessEvent( event );
 
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointUpOutside );
   application.ProcessEvent( event );
 
-  DALI_TEST_CHECK( !gButtonClicked );
+  DALI_TEST_CHECK( !gIsCalledButtonCallback );
 
   // Test3. Touch point down inside and up outside the button.
 
 
   // Test3. Touch point down inside and up outside the button.
 
-  gButtonClicked = false;
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownInside );
   application.ProcessEvent( event );
 
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownInside );
   application.ProcessEvent( event );
 
+  DALI_TEST_CHECK( gIsCalledButtonCallback );
+
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointLeave );
   application.ProcessEvent( event );
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointLeave );
   application.ProcessEvent( event );
@@ -221,15 +380,18 @@ int UtcDaliButtonClicked(void)
   event.AddPoint( pointUpOutside );
   application.ProcessEvent( event );
 
   event.AddPoint( pointUpOutside );
   application.ProcessEvent( event );
 
-  DALI_TEST_CHECK( !gButtonClicked );
+  DALI_TEST_CHECK( gIsCalledButtonCallback );
 
   // Test4. Touch point down outside and up inside the button.
 
 
   // Test4. Touch point down outside and up inside the button.
 
-  gButtonClicked = false;
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownOutside );
   application.ProcessEvent( event );
 
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownOutside );
   application.ProcessEvent( event );
 
+  DALI_TEST_CHECK( !gIsCalledButtonCallback );
+
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointEnter );
   application.ProcessEvent( event );
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointEnter );
   application.ProcessEvent( event );
@@ -238,48 +400,34 @@ int UtcDaliButtonClicked(void)
   event.AddPoint( pointUpInside );
   application.ProcessEvent( event );
 
   event.AddPoint( pointUpInside );
   application.ProcessEvent( event );
 
-  DALI_TEST_CHECK( !gButtonClicked );
+  DALI_TEST_CHECK( !gIsCalledButtonCallback );
   END_TEST;
 }
 
   END_TEST;
 }
 
-namespace
-{
-
-static bool gClickedCallBackCalled;
-
-static bool TestClickedCallback(Button button)
-{
-  gClickedCallBackCalled = true;
-  return true;
-}
-
-} // namespace
-
-int UtcDaliButtonConnectSignal(void)
+int UtcDaliButtonClickedSignalP(void)
 {
   ToolkitTestApplication application;
 {
   ToolkitTestApplication application;
-  tet_infoline("UtcDaliButtonConnectSignal()");
-
-  gClickedCallBackCalled = false;
+  tet_infoline(" UtcDaliButtonClickedSignalP");
 
 
-  PushButton pushButton = PushButton::New();
-  pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
-  pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
-  pushButton.SetPosition( 240, 400 );
-  pushButton.SetSize( 100, 100 );
+  Button button = PushButton::New();
+  button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  button.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  button.SetPosition( 240, 400 );
+  button.SetSize( 100, 100 );
 
 
-  Stage::GetCurrent().Add( pushButton );
+  Stage::GetCurrent().Add( button );
 
   application.SendNotification();
   application.Render();
 
 
   application.SendNotification();
   application.Render();
 
-  // connect to its clicked signal
-  pushButton.ClickedSignal().Connect(TestClickedCallback);
+  // connect to its touch signal
+  button.ClickedSignal().Connect( &ButtonCallback );
 
   Dali::Integration::TouchEvent event;
 
 
   Dali::Integration::TouchEvent event;
 
-  // Touch point down and up inside the button.
+  // Test1. Touch point down and up inside the button.
 
 
+  gIsCalledButtonCallback = false;
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownInside );
   application.ProcessEvent( event );
   event = Dali::Integration::TouchEvent();
   event.AddPoint( pointDownInside );
   application.ProcessEvent( event );
@@ -288,28 +436,126 @@ int UtcDaliButtonConnectSignal(void)
   event.AddPoint( pointUpInside );
   application.ProcessEvent( event );
 
   event.AddPoint( pointUpInside );
   application.ProcessEvent( event );
 
-  DALI_TEST_CHECK( gClickedCallBackCalled == true );
+  DALI_TEST_CHECK( gIsCalledButtonCallback );
+
+  // Test2. Touch point down and up outside the button.
+
+  gIsCalledButtonCallback = false;
+  event = Dali::Integration::TouchEvent();
+  event.AddPoint( pointDownOutside );
+  application.ProcessEvent( event );
+
+  event = Dali::Integration::TouchEvent();
+  event.AddPoint( pointUpOutside );
+  application.ProcessEvent( event );
+
+  DALI_TEST_CHECK( !gIsCalledButtonCallback );
 
 
-  gClickedCallBackCalled = false;
-  pushButton.ClickedSignal().Disconnect(TestClickedCallback);
+  // Test3. Touch point down inside and up outside the button.
 
 
-  // simulate another touch event
+  gIsCalledButtonCallback = false;
+  event = Dali::Integration::TouchEvent();
+  event.AddPoint( pointDownInside );
   application.ProcessEvent( event );
 
   application.ProcessEvent( event );
 
-  DALI_TEST_CHECK( gClickedCallBackCalled == false );
+  event = Dali::Integration::TouchEvent();
+  event.AddPoint( pointLeave );
+  application.ProcessEvent( event );
+
+  event = Dali::Integration::TouchEvent();
+  event.AddPoint( pointUpOutside );
+  application.ProcessEvent( event );
+
+  DALI_TEST_CHECK( !gIsCalledButtonCallback );
+
+  // Test4. Touch point down outside and up inside the button.
+
+  gIsCalledButtonCallback = false;
+  event = Dali::Integration::TouchEvent();
+  event.AddPoint( pointDownOutside );
+  application.ProcessEvent( event );
+
+  event = Dali::Integration::TouchEvent();
+  event.AddPoint( pointEnter );
+  application.ProcessEvent( event );
+
+  event = Dali::Integration::TouchEvent();
+  event.AddPoint( pointUpInside );
+  application.ProcessEvent( event );
+
+  DALI_TEST_CHECK( !gIsCalledButtonCallback );
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliButtonSetGetAnimationTime(void)
+int UtcDaliButtonStateChangedSignalP(void)
 {
   ToolkitTestApplication application;
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetGetAnimationTime");
+  tet_infoline(" UtcDaliButtonStateChangedSignalP");
+
+  Button button = PushButton::New();
+  button.SetTogglableButton( true );
+
+  Stage::GetCurrent().Add( button );
+
+  application.SendNotification();
+  application.Render();
+
+  // connect to its signal
+  button.StateChangedSignal().Connect( &ButtonCallback );
+
+  gIsCalledButtonCallback = false;
+  button.SetSelected( true );
+
+  DALI_TEST_CHECK( gIsCalledButtonCallback );
+
+  gIsCalledButtonCallback = false;
+  button.SetSelected( false );
+
+  DALI_TEST_CHECK( gIsCalledButtonCallback );
+  END_TEST;
+}
+
+int UtcDaliButtonSetProperty(void)
+{
+  tet_infoline("UtcDaliButtonSetProperty: ");
+  ToolkitTestApplication application;
 
   PushButton pushButton = PushButton::New();
 
 
   PushButton pushButton = PushButton::New();
 
-  pushButton.SetAnimationTime( ANIMATION_TIME );
+  pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), false);
+  DALI_TEST_CHECK( false == pushButton.IsDisabled() );
+  pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), true);
+  DALI_TEST_CHECK( true == pushButton.IsDisabled() );
+  END_TEST;
+}
+
+int UtcDaliButtonSize(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliButtonSize");
+
+  ImageActor image01 = ImageActor::New(CreateBufferImage());
+  image01.SetSize( 100, 50 );
+
+  PushButton pushButton;
+
+  Vector3 size;
+
+  // Test1 Size is set through Actor API
+
+  // First an image is set, then SetSize is called.
+  pushButton = PushButton::New();
+  Stage::GetCurrent().Add( pushButton );
+
+  pushButton.SetBackgroundImage( image01 );
+  pushButton.SetSize( 10.f, 10.f );
 
 
-  DALI_TEST_EQUALS( pushButton.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION );
+  application.SendNotification();
+  application.Render();
 
 
+  size = pushButton.GetCurrentSize();
+
+  DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
+  DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
   END_TEST;
 }
   END_TEST;
 }
index d6dc8d4..f5a2a7c 100644 (file)
@@ -33,8 +33,6 @@ bool CheckBoxButtonClicked( Button button )
   return true;
 }
 
   return true;
 }
 
-
-
 Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
 {
   BufferImage imageData = BufferImage::New( width, height, Pixel::RGBA8888 );
 Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
 {
   BufferImage imageData = BufferImage::New( width, height, Pixel::RGBA8888 );
@@ -58,7 +56,6 @@ Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned
 
 } // namespace
 
 
 } // namespace
 
-
 void checkbox_button_startup(void)
 {
   test_return_value = TET_UNDEF;
 void checkbox_button_startup(void)
 {
   test_return_value = TET_UNDEF;
@@ -69,6 +66,169 @@ void checkbox_button_cleanup(void)
   test_return_value = TET_PASS;
 }
 
   test_return_value = TET_PASS;
 }
 
+int UtcDaliCheckBoxButtonConstructorP(void)
+{
+  TestApplication application;
+
+  CheckBoxButton checkBox;
+
+  DALI_TEST_CHECK( !checkBox );
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonCopyConstructorP(void)
+{
+  TestApplication application;
+
+  // Initialize an object, ref count == 1
+  CheckBoxButton checkBox = CheckBoxButton::New();
+
+  CheckBoxButton copy( checkBox );
+  DALI_TEST_CHECK( copy );
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonAssignmentOperatorP(void)
+{
+  TestApplication application;
+
+  CheckBoxButton checkBox = CheckBoxButton::New();
+
+  CheckBoxButton copy( checkBox );
+  DALI_TEST_CHECK( copy );
+
+  DALI_TEST_CHECK( checkBox == copy );
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonNewP(void)
+{
+  TestApplication application;
+
+  CheckBoxButton checkBox = CheckBoxButton::New();
+
+  DALI_TEST_CHECK( checkBox );
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonDownCastP(void)
+{
+  TestApplication application;
+
+  CheckBoxButton checkBox = CheckBoxButton::New();
+
+  BaseHandle object(checkBox);
+
+  CheckBoxButton checkBox2 = CheckBoxButton::DownCast( object );
+  DALI_TEST_CHECK(checkBox2);
+
+  CheckBoxButton checkBox3 = DownCast< CheckBoxButton >(object);
+  DALI_TEST_CHECK(checkBox3);
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonDownCastN(void)
+{
+  TestApplication application;
+
+  BaseHandle unInitializedObject;
+
+  CheckBoxButton checkBox1 = CheckBoxButton::DownCast( unInitializedObject );
+  DALI_TEST_CHECK( !checkBox1 );
+
+  CheckBoxButton checkBox2 = DownCast< CheckBoxButton >( unInitializedObject );
+  DALI_TEST_CHECK( !checkBox2 );
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonSetBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliCheckBoxButtonSetBackgroundImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  CheckBoxButton checkBoxButton = CheckBoxButton::New();
+
+  checkBoxButton.SetBackgroundImage( image );
+
+  DALI_TEST_CHECK( checkBoxButton.GetBackgroundImage() );
+
+  checkBoxButton.SetBackgroundImage( imageActor );
+
+  DALI_TEST_CHECK( checkBoxButton.GetBackgroundImage() );
+
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonSetSelectedImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliCheckBoxButtonSetSelectedImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  CheckBoxButton checkBoxButton = CheckBoxButton::New();
+
+  checkBoxButton.SetSelectedImage( image );
+
+  DALI_TEST_CHECK( checkBoxButton.GetSelectedImage() );
+
+  checkBoxButton.SetSelectedImage( imageActor );
+
+  DALI_TEST_CHECK( checkBoxButton.GetSelectedImage() );
+
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonSetDisabledBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliCheckBoxButtonSetDisabledBackgroundImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  CheckBoxButton checkBoxButton = CheckBoxButton::New();
+
+  checkBoxButton.SetDisabledBackgroundImage( image );
+
+  DALI_TEST_CHECK( checkBoxButton.GetDisabledBackgroundImage() );
+
+  checkBoxButton.SetDisabledBackgroundImage( imageActor );
+
+  DALI_TEST_CHECK( checkBoxButton.GetDisabledBackgroundImage() );
+
+  END_TEST;
+}
+
+int UtcDaliCheckBoxButtonSetDisabledSelectedImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliCheckBoxButtonSetDisabledSelectedImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  CheckBoxButton checkBoxButton = CheckBoxButton::New();
+
+  checkBoxButton.SetDisabledSelectedImage( image );
+
+  DALI_TEST_CHECK( checkBoxButton.GetDisabledSelectedImage() );
+
+  checkBoxButton.SetDisabledSelectedImage( imageActor );
+
+  DALI_TEST_CHECK( checkBoxButton.GetDisabledSelectedImage() );
+
+  END_TEST;
+}
+
 int UtcDaliCheckBoxButtonSetGetSelected(void)
 {
   ToolkitTestApplication application;
 int UtcDaliCheckBoxButtonSetGetSelected(void)
 {
   ToolkitTestApplication application;
index 49a9b0b..43e362e 100644 (file)
@@ -32,6 +32,7 @@
 #include <dali/integration-api/events/pan-gesture-event.h>
 #include <dali/integration-api/events/tap-gesture-event.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/pan-gesture-event.h>
 #include <dali/integration-api/events/tap-gesture-event.h>
 #include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/hover-event-integ.h>
 
 #include "dummy-control.h"
 
 
 #include "dummy-control.h"
 
@@ -591,6 +592,56 @@ int UtcDaliControlImplTouchEvent(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
+int UtcDaliControlImplHoverEvent(void)
+{
+  ToolkitTestApplication application;
+
+  {
+    DummyControl dummy = DummyControl::New( true );
+    DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
+    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+    Stage::GetCurrent().Add(dummy);
+
+    application.Render();
+    application.SendNotification();
+    application.Render();
+    application.SendNotification();
+
+    DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, false, TEST_LOCATION );
+    Integration::HoverEvent event(1);
+    TouchPoint point( 1, TouchPoint::Motion, 20.0f, 20.0f );
+    event.AddPoint( point );
+    application.ProcessEvent( event );
+    DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, true, TEST_LOCATION );
+
+    Stage::GetCurrent().Remove(dummy);
+  }
+
+  // Ensure full code coverage
+  {
+    DummyControl dummy = DummyControl::New();
+
+    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
+    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+    Stage::GetCurrent().Add(dummy);
+
+    application.Render();
+    application.SendNotification();
+    application.Render();
+    application.SendNotification();
+
+    Integration::HoverEvent event(1);
+    TouchPoint point( 1, TouchPoint::Motion, 20.0f, 20.0f );
+    event.AddPoint( point );
+    application.ProcessEvent( event );
+
+    Stage::GetCurrent().Remove(dummy);
+  }
+  END_TEST;
+}
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 
@@ -787,3 +838,24 @@ int UtcDaliControlImplMouseWheelEvent(void)
   }
   END_TEST;
 }
   }
   END_TEST;
 }
+
+int UtcDaliControlImplSetStyleName(void)
+{
+  ToolkitTestApplication application;
+
+  {
+    DummyControl dummy = DummyControl::New( true );
+    DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+
+    dummy.SetSize( Vector2( 100.0f, 100.0f ) );
+    dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+    Stage::GetCurrent().Add(dummy);
+
+    dummy.SetStyleName("TestStyle");
+
+    DALI_TEST_CHECK( dummy.GetStyleName() == "TestStyle" );
+
+    Stage::GetCurrent().Remove(dummy);
+  }
+  END_TEST;
+}
index b04201b..d9e52fd 100644 (file)
@@ -88,9 +88,50 @@ int UtcDaliItemLayoutSetAndGetOrientation(void)
 
   // Set the orientation of the layout to be horizontal from left to right
   ItemLayoutPtr layout = view.GetLayout(0);
 
   // Set the orientation of the layout to be horizontal from left to right
   ItemLayoutPtr layout = view.GetLayout(0);
+
+  DALI_TEST_CHECK(gridLayout == layout);
+
   layout->SetOrientation(ControlOrientation::Left);
 
   // Check the orientation of the layout is horizontal from left to right
   DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left);
   layout->SetOrientation(ControlOrientation::Left);
 
   // Check the orientation of the layout is horizontal from left to right
   DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left);
+
+  Vector3 itemSize(100.0f, 100.0f, 100.0f);
+  layout->SetItemSize(itemSize);
+
+  Vector3 itemSize1;
+  layout->GetItemSize(0u, Vector3(Stage::GetCurrent().GetSize()), itemSize1);
+
+  DALI_TEST_CHECK(itemSize == itemSize1);
+
+  float position = layout->GetClosestOnScreenLayoutPosition(0, 0.0f, Vector3(Stage::GetCurrent().GetSize()));
+
+  DALI_TEST_EQUALS(position, 0.0f, TEST_LOCATION);
+
+  int focusItem = layout->GetNextFocusItemID(0, TOTAL_ITEM_NUMBER, Control::Left, true);
+
+  DALI_TEST_CHECK(focusItem != 0);
+
+  float flickSpeedFactor = layout->GetFlickSpeedFactor();
+
+  DALI_TEST_CHECK(flickSpeedFactor != 0.0f);
+
+  ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
+  view.AddLayout(*depthLayout);
+
+  layout = view.GetLayout(1);
+  DALI_TEST_CHECK(depthLayout == layout);
+
+  ItemLayoutPtr listLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
+  view.AddLayout(*listLayout);
+
+  layout = view.GetLayout(2);
+  DALI_TEST_CHECK(listLayout == layout);
+
+  ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+  view.AddLayout(*spiralLayout);
+
+  layout = view.GetLayout(3);
+  DALI_TEST_CHECK(spiralLayout == layout);
   END_TEST;
 }
   END_TEST;
 }
index 920e152..9efd53f 100644 (file)
@@ -443,6 +443,8 @@ int UtcDaliItemViewSetAndGetRefreshInterval(void)
   // Set the interval between refreshes to be 20
   view.SetRefreshInterval(20);
 
   // Set the interval between refreshes to be 20
   view.SetRefreshInterval(20);
 
+  view.Refresh();
+
   // Check the interval between refreshes is 20
   DALI_TEST_CHECK(view.GetRefreshInterval() == 20);
   END_TEST;
   // Check the interval between refreshes is 20
   DALI_TEST_CHECK(view.GetRefreshInterval() == 20);
   END_TEST;
@@ -538,3 +540,226 @@ int UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep(void)
   DALI_TEST_EQUALS(view.GetMouseWheelScrollDistanceStep(), 100.0f, TEST_LOCATION );
   END_TEST;
 }
   DALI_TEST_EQUALS(view.GetMouseWheelScrollDistanceStep(), 100.0f, TEST_LOCATION );
   END_TEST;
 }
+
+int UtcDaliItemViewInsertItemP(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  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);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  // Get the item given the item ID
+  Actor itemActor = view.GetItem(2);
+
+  ItemId id = view.GetItemId( itemActor );
+
+  // Check we are getting the correct Item ID given the specified actor
+  DALI_TEST_CHECK(view.GetItemId(itemActor) == 2);
+
+  Actor newActor = Actor::New();
+
+  view.InsertItem(Item(id, newActor), 0.5f);
+
+  DALI_TEST_CHECK(view.GetItem(2) == newActor);
+  END_TEST;
+}
+
+int UtcDaliItemViewInsertItemsP(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  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);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  unsigned int itemCount = view.GetChildCount();
+
+  ItemContainer insertList;
+
+  for( unsigned int i = 0u; i < 10; ++i )
+  {
+    Actor child = view.GetChildAt( i );
+    Actor newActor = Actor::New();
+    newActor.SetName("Inserted");
+    insertList.push_back( Item( view.GetItemId(child), newActor ) );
+  }
+
+  if( !insertList.empty() )
+  {
+    view.InsertItems( insertList, 0.5f );
+  }
+
+  DALI_TEST_CHECK(view.GetChildCount() == itemCount + 10);
+
+  ItemIdContainer removeList;
+
+  for( unsigned int i = 0u; i < view.GetChildCount(); ++i )
+  {
+    Actor child = view.GetChildAt( i );
+
+    if( child.GetName() == "Inserted" )
+    {
+      removeList.push_back( view.GetItemId(child) );
+    }
+  }
+
+  if( ! removeList.empty() )
+  {
+    view.RemoveItems( removeList, 0.5f );
+  }
+
+  DALI_TEST_CHECK(view.GetChildCount() == itemCount);
+  END_TEST;
+}
+
+int UtcDaliItemViewReplaceItemP(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  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);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  Actor newActor = Actor::New();
+
+  view.ReplaceItem( Item( 0, newActor ), 0.5f );
+
+  DALI_TEST_CHECK(view.GetItem(0) == newActor);
+  END_TEST;
+}
+
+int UtcDaliItemViewReplaceItemsP(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  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);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  ItemContainer replaceList;
+
+  for( unsigned int i = 0u; i < 10; ++i )
+  {
+    Actor child = view.GetChildAt( i );
+    Actor newActor = Actor::New();
+    newActor.SetName("Replaced");
+
+    replaceList.push_back( Item( view.GetItemId(child), newActor ) );
+  }
+
+  if( !replaceList.empty() )
+  {
+    view.ReplaceItems( replaceList, 0.5f );
+  }
+
+  DALI_TEST_CHECK(view.GetItem(0).GetName() == "Replaced");
+  DALI_TEST_CHECK(view.GetItem(8).GetName() == "Replaced");
+  END_TEST;
+}
+
+int UtcDaliItemViewGetItemsRangeP(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  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);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  ItemRange itemRange(0, 0);
+
+  view.GetItemsRange(itemRange);
+
+  DALI_TEST_CHECK(itemRange.Within(0));
+  END_TEST;
+}
+
+int UtcDaliItemViewSetItemsAnchorPointP(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  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);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  Vector3 anchorPoint(10.0f, 10.0f, 0.0f);
+
+  view.SetItemsAnchorPoint(anchorPoint);
+
+  DALI_TEST_CHECK(view.GetItemsAnchorPoint() == anchorPoint);
+  DALI_TEST_CHECK(view.GetItem(0).GetCurrentAnchorPoint() == anchorPoint);
+  END_TEST;
+}
+
+int UtcDaliItemViewSetItemsParentOriginP(void)
+{
+  ToolkitTestApplication application;
+
+  // Create the ItemView actor
+  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);
+
+  // Activate the grid layout so that the items will be created and added to ItemView
+  Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
+  view.ActivateLayout(0, stageSize, 0.5f);
+
+  Vector3 parentOrigin(10.0f, 10.0f, 0.0f);
+
+  view.SetItemsParentOrigin(parentOrigin);
+
+  DALI_TEST_CHECK(view.GetItemsParentOrigin() == parentOrigin);
+  DALI_TEST_CHECK(view.GetItem(0).GetCurrentParentOrigin() == parentOrigin);
+  END_TEST;
+}
index 4b62045..ecf4907 100644 (file)
@@ -96,6 +96,224 @@ Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned
 
 } //namespace
 
 
 } //namespace
 
+int UtcDaliPushButtonConstructorP(void)
+{
+  TestApplication application;
+
+  PushButton button;
+
+  DALI_TEST_CHECK( !button );
+  END_TEST;
+}
+
+int UtcDaliPushButtonCopyConstructorP(void)
+{
+  TestApplication application;
+
+  // Initialize an object, ref count == 1
+  PushButton button = PushButton::New();
+
+  PushButton copy( button );
+  DALI_TEST_CHECK( copy );
+  END_TEST;
+}
+
+int UtcDaliPushButtonAssignmentOperatorP(void)
+{
+  TestApplication application;
+
+  PushButton button = PushButton::New();
+
+  PushButton copy( button );
+  DALI_TEST_CHECK( copy );
+
+  DALI_TEST_CHECK( button == copy );
+  END_TEST;
+}
+
+int UtcDaliPushButtonNewP(void)
+{
+  TestApplication application;
+
+  PushButton button = PushButton::New();
+
+  DALI_TEST_CHECK( button );
+  END_TEST;
+}
+
+int UtcDaliPushButtonDownCastP(void)
+{
+  TestApplication application;
+
+  PushButton button = PushButton::New();
+
+  BaseHandle object(button);
+
+  PushButton button2 = PushButton::DownCast( object );
+  DALI_TEST_CHECK(button2);
+
+  PushButton button3 = DownCast< PushButton >(object);
+  DALI_TEST_CHECK(button3);
+  END_TEST;
+}
+
+int UtcDaliPushButtonDownCastN(void)
+{
+  TestApplication application;
+
+  BaseHandle unInitializedObject;
+
+  PushButton button1 = PushButton::DownCast( unInitializedObject );
+  DALI_TEST_CHECK( !button1 );
+
+  PushButton button2 = DownCast< PushButton >( unInitializedObject );
+  DALI_TEST_CHECK( !button2 );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetButtonImage(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetButtonImage");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  PushButton pushButton = PushButton::New();
+  Stage::GetCurrent().Add( pushButton );
+
+  application.SendNotification();
+  application.Render();
+
+  pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
+  pushButton.SetButtonImage( image );
+
+  DALI_TEST_CHECK( pushButton.GetButtonImage() );
+
+  application.SendNotification();
+  application.Render();
+
+  Vector3 size = pushButton.GetCurrentSize();
+
+  DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION );
+  DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION );
+
+  pushButton.SetButtonImage( imageActor );
+
+  DALI_TEST_CHECK( pushButton.GetButtonImage() );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetBackgroundImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetBackgroundImage( image );
+
+  DALI_TEST_CHECK( pushButton.GetBackgroundImage() );
+
+  pushButton.SetBackgroundImage( imageActor );
+
+  DALI_TEST_CHECK( pushButton.GetBackgroundImage() );
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetSelectedImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetSelectedImage( image );
+
+  DALI_TEST_CHECK( pushButton.GetSelectedImage() );
+
+  pushButton.SetSelectedImage( imageActor );
+
+  DALI_TEST_CHECK( pushButton.GetSelectedImage() );
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetSelectedBackgroundImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetSelectedBackgroundImage( image );
+
+  DALI_TEST_CHECK( pushButton.GetSelectedBackgroundImage() );
+
+  pushButton.SetSelectedBackgroundImage( imageActor );
+
+  DALI_TEST_CHECK( pushButton.GetSelectedBackgroundImage() );
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledBackgroundImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetDisabledBackgroundImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetDisabledBackgroundImage( image );
+
+  DALI_TEST_CHECK( pushButton.GetDisabledBackgroundImage() );
+
+  pushButton.SetDisabledBackgroundImage( imageActor );
+
+  DALI_TEST_CHECK( pushButton.GetDisabledBackgroundImage() );
+
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledImageP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetDisabledImageP");
+
+  Image image = CreateSolidColorImage( Color::RED, 10, 10 );
+  ImageActor imageActor = CreateSolidColorActor( Color::RED );
+  imageActor.SetSize( 20, 20 );
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetDisabledImage( image );
+
+  DALI_TEST_CHECK( pushButton.GetDisabledImage() );
+
+  pushButton.SetDisabledImage( imageActor );
+
+  DALI_TEST_CHECK( pushButton.GetDisabledImage() );
+
+  END_TEST;
+}
 
 int UtcDaliPushButtonSetGetAutoRepeating(void)
 {
 
 int UtcDaliPushButtonSetGetAutoRepeating(void)
 {
@@ -271,36 +489,6 @@ int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliPushButtonSetImages(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliPushButtonSetImages");
-
-  Actor imageActor;
-
-  Image image01 = CreateSolidColorImage( Color::RED, 10, 10 );
-
-  Vector3 size;
-  PushButton pushButton = PushButton::New();
-  Stage::GetCurrent().Add( pushButton );
-
-  application.SendNotification();
-  application.Render();
-
-  pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
-  pushButton.SetButtonImage( image01 );
-
-  application.SendNotification();
-  application.Render();
-
-  size = pushButton.GetCurrentSize();
-
-  DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION );
-  DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION );
-
-  END_TEST;
-}
-
 int UtcDaliPushButtonSetLabelText(void)
 {
   ToolkitTestApplication application;
 int UtcDaliPushButtonSetLabelText(void)
 {
   ToolkitTestApplication application;
index c20a167..521d6ca 100644 (file)
@@ -47,10 +47,45 @@ static void TestCallback(BaseHandle handle)
 
 }
 
 
 }
 
-int UtcDaliRadioButtonNew(void)
+int UtcDaliRadioButtonConstructorP(void)
+{
+  TestApplication application;
+
+  RadioButton button;
+
+  DALI_TEST_CHECK( !button );
+  END_TEST;
+}
+
+int UtcDaliRadioButtonCopyConstructorP(void)
+{
+  TestApplication application;
+
+  // Initialize an object, ref count == 1
+  RadioButton button = RadioButton::New();
+
+  RadioButton copy( button );
+  DALI_TEST_CHECK( copy );
+  END_TEST;
+}
+
+int UtcDaliRadioButtonAssignmentOperatorP(void)
+{
+  TestApplication application;
+
+  RadioButton button = RadioButton::New();
+
+  RadioButton copy( button );
+  DALI_TEST_CHECK( copy );
+
+  DALI_TEST_CHECK( button == copy );
+  END_TEST;
+}
+
+int UtcDaliRadioButtonNewP(void)
 {
   ToolkitTestApplication application;
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliRadioButtonNew");
+  tet_infoline(" UtcDaliRadioButtonNewP");
 
   // Create the Slider actor
   RadioButton radioButton;
 
   // Create the Slider actor
   RadioButton radioButton;
@@ -78,7 +113,7 @@ int UtcDaliRadioButtonNew(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliRadioButtonDestructor(void)
+int UtcDaliRadioButtonDestructorP(void)
 {
   ToolkitTestApplication application;
 
 {
   ToolkitTestApplication application;