bool* mCallbackFlag;
};
-
-Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
-{
- BufferImage imageData = BufferImage::New( width, height, Pixel::RGBA8888 );
-
- // Create the image
- PixelBuffer* pixbuf = imageData.GetBuffer();
- unsigned int size = width * height;
-
- for( size_t i = 0; i < size; i++ )
- {
- pixbuf[i*4+0] = 0xFF * color.r;
- pixbuf[i*4+1] = 0xFF * color.g;
- pixbuf[i*4+2] = 0xFF * color.b;
- pixbuf[i*4+3] = 0xFF * color.a;
- }
-
- imageData.Update();
-
- return imageData;
-}
-
Dali::Integration::Point GetPointDownInside()
{
Dali::Integration::Point point;
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;
+}
+
+int UtcDaliButtonSetSelectedColorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetSelectedColorP");
+
+ PushButton pushButton = PushButton::New();
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector4 SET_COLOR = Color::BLUE;
+
+ pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
+ pushButton.SetProperty( Button::Property::SELECTED_COLOR, SET_COLOR );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
+
+ DALI_TEST_EQUALS( color, SET_COLOR, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetUnSelectedColorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetUnSelectedColorP");
+
+ PushButton pushButton = PushButton::New();
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector4 SET_COLOR = Color::BLUE;
+
+ pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
+ pushButton.SetProperty( Button::Property::UNSELECTED_COLOR, SET_COLOR );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::UNSELECTED_COLOR );
+
+ DALI_TEST_EQUALS( color, SET_COLOR, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliButtonResetSelectedColorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetSelectedColorP");
+
+ PushButton pushButton = PushButton::New();
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector4 FIRST_COLOR = Color::BLUE;
+ const Vector4 SECOND_COLOR = Color::BLUE;
+
+ pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
+ pushButton.SetProperty( Button::Property::SELECTED_COLOR, FIRST_COLOR );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
+
+ DALI_TEST_EQUALS( color, FIRST_COLOR, TEST_LOCATION );
+
+ pushButton.SetProperty( Button::Property::SELECTED_COLOR, SECOND_COLOR );
+
+ application.SendNotification();
+ application.Render();
+
+ color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
+
+ DALI_TEST_EQUALS( color, SECOND_COLOR, TEST_LOCATION );
+
+ END_TEST;
+}