#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+
+
using namespace Dali;
using namespace Toolkit;
return true;
}
-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;
-}
-
} // namespace
void checkbox_button_startup(void)
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;
END_TEST;
}
-int UtcDaliCheckBoxButtonSetImages(void)
+int UtcDaliCheckBoxSetLabelP(void)
{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliCheckBoxButtonSetImages");
+ TestApplication application;
- Actor imageActor;
+ CheckBoxButton checkBox = CheckBoxButton::New();
- Image image01 = CreateSolidColorImage( Color::RED, 10, 10 );
- ImageActor imageActor01 = CreateSolidColorActor( Color::RED );
- imageActor01.SetSize( 20, 20 );
+ Property::Map propertyMap;
- Image image02 = CreateSolidColorImage( Color::RED, 30, 30 );
- ImageActor imageActor02 = CreateSolidColorActor( Color::RED );
- imageActor02.SetSize( 40, 40 );
- imageActor02.SetName( "imageActor02" );
+ propertyMap.Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+ .Add( Toolkit::TextVisual::Property::TEXT, "activate" )
+ .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f );
- Image image03 = CreateSolidColorImage( Color::RED, 50, 50 );
- ImageActor imageActor03 = CreateSolidColorActor( Color::RED );
- imageActor03.SetSize( 60, 60 );
+ checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
- Image image04 = CreateSolidColorImage( Color::RED, 70, 70 );
- ImageActor imageActor04 = CreateSolidColorActor( Color::RED );
- imageActor04.SetSize( 80, 80 );
+ DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION ); // Change to use GerProperty once that code is implemented
+ END_TEST;
+}
- Vector3 size;
- CheckBoxButton checkBoxButton = CheckBoxButton::New();
- checkBoxButton.SetName( "UtcDaliCheckBoxButtonSetImages" );
- Stage::GetCurrent().Add( checkBoxButton );
+int UtcDaliCheckBoxSetLabelDisabledP(void)
+{
+ TestApplication application;
+
+ CheckBoxButton checkBox = CheckBoxButton::New();
+ Stage::GetCurrent().Add( checkBox );
+
+ checkBox.SetSize( Vector2( 20.0f, 20.0f ) );
+ checkBox.SetDisabledBackgroundImage( "Image.jpg" );
application.SendNotification();
application.Render();
- // Just check if check box button size changes when a bigger image is set.
+ Property::Map propertyMap;
- checkBoxButton.SetBackgroundImage( image01 );
+ propertyMap.Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+ .Add( Toolkit::TextVisual::Property::TEXT, "activate" )
+ .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f );
- application.SendNotification();
- application.Render();
+ checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), true);
+ checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
+
+ DALI_TEST_CHECK( checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
+ DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION ); // Change to use GetProperty once that code is implemented
+
+ END_TEST;
+}
+
+int UtcDaliCheckBoxSettingDisabled(void)
+{
+ ToolkitTestApplication application;
+
+ CheckBoxButton checkBox = CheckBoxButton::New();
- size = checkBoxButton.GetCurrentSize();
+ checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), true);
+ DALI_TEST_CHECK( checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
- DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+ checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), false);
- checkBoxButton.SetBackgroundImage( imageActor01 );
+ DALI_TEST_CHECK( !checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
END_TEST;
}