{
static bool gCheckBoxButtonState = false;
-bool CheckBoxButtonClicked( Button button, bool state )
+bool CheckBoxButtonClicked( Button button )
{
- gCheckBoxButtonState = state;
+ gCheckBoxButtonState = button.IsSelected();
return true;
}
-
-
-Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
-{
- BitmapImage imageData = BitmapImage::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)
{
test_return_value = TET_UNDEF;
test_return_value = TET_PASS;
}
-int UtcDaliCheckBoxButtonSetGetChecked(void)
+int UtcDaliCheckBoxButtonConstructorP(void)
{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliCheckBoxButtonSetGetChecked");
+ TestApplication application;
- CheckBoxButton checkBoxButton = CheckBoxButton::New();
- checkBoxButton.StateChangedSignal().Connect( &CheckBoxButtonClicked );
+ CheckBoxButton checkBox;
- // global var used to check if CheckBoxButtonClicked is called;
- gCheckBoxButtonState = false;
+ DALI_TEST_CHECK( !checkBox );
+ END_TEST;
+}
+
+int UtcDaliCheckBoxButtonCopyConstructorP(void)
+{
+ TestApplication application;
- checkBoxButton.SetChecked( true );
+ // Initialize an object, ref count == 1
+ CheckBoxButton checkBox = CheckBoxButton::New();
- DALI_TEST_CHECK( checkBoxButton.IsChecked() );
- DALI_TEST_CHECK( gCheckBoxButtonState );
+ CheckBoxButton copy( checkBox );
+ DALI_TEST_CHECK( copy );
+ END_TEST;
+}
- checkBoxButton.SetChecked( false );
+int UtcDaliCheckBoxButtonAssignmentOperatorP(void)
+{
+ TestApplication application;
- DALI_TEST_CHECK( !checkBoxButton.IsChecked() );
- DALI_TEST_CHECK( !gCheckBoxButtonState );
+ CheckBoxButton checkBox = CheckBoxButton::New();
- checkBoxButton.SetChecked( true );
+ CheckBoxButton copy( checkBox );
+ DALI_TEST_CHECK( copy );
- DALI_TEST_CHECK( checkBoxButton.IsChecked() );
- DALI_TEST_CHECK( gCheckBoxButtonState );
+ DALI_TEST_CHECK( checkBox == copy );
END_TEST;
}
-int UtcDaliCheckBoxButtonSetImages(void)
+int UtcDaliCheckBoxButtonNewP(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 );
+ DALI_TEST_CHECK( checkBox );
+ END_TEST;
+}
- Image image02 = CreateSolidColorImage( Color::RED, 30, 30 );
- ImageActor imageActor02 = CreateSolidColorActor( Color::RED );
- imageActor02.SetSize( 40, 40 );
+int UtcDaliCheckBoxButtonDownCastP(void)
+{
+ TestApplication application;
- Image image03 = CreateSolidColorImage( Color::RED, 50, 50 );
- ImageActor imageActor03 = CreateSolidColorActor( Color::RED );
- imageActor03.SetSize( 60, 60 );
+ CheckBoxButton checkBox = CheckBoxButton::New();
- Image image04 = CreateSolidColorImage( Color::RED, 70, 70 );
- ImageActor imageActor04 = CreateSolidColorActor( Color::RED );
- imageActor04.SetSize( 80, 80 );
+ BaseHandle object(checkBox);
- Vector3 size;
- CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ CheckBoxButton checkBox2 = CheckBoxButton::DownCast( object );
+ DALI_TEST_CHECK(checkBox2);
- application.SendNotification();
- application.Render();
+ CheckBoxButton checkBox3 = DownCast< CheckBoxButton >(object);
+ DALI_TEST_CHECK(checkBox3);
+ END_TEST;
+}
- // Just check if check box button size changes when a bigger image is set.
+int UtcDaliCheckBoxButtonDownCastN(void)
+{
+ TestApplication application;
- checkBoxButton.SetBackgroundImage( image01 );
+ BaseHandle unInitializedObject;
- application.SendNotification();
- application.Render();
-
- size = checkBoxButton.GetBackgroundImage().GetCurrentSize();
+ CheckBoxButton checkBox1 = CheckBoxButton::DownCast( unInitializedObject );
+ DALI_TEST_CHECK( !checkBox1 );
- DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+ CheckBoxButton checkBox2 = DownCast< CheckBoxButton >( unInitializedObject );
+ DALI_TEST_CHECK( !checkBox2 );
+ END_TEST;
+}
- checkBoxButton.SetBackgroundImage( imageActor01 );
+int UtcDaliCheckBoxButtonSetGetSelected(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCheckBoxButtonSetGetSelected");
- application.SendNotification();
- application.Render();
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ checkBoxButton.StateChangedSignal().Connect( &CheckBoxButtonClicked );
- size = checkBoxButton.GetBackgroundImage().GetCurrentSize();
+ // global var used to check if CheckBoxButtonClicked is called;
+ gCheckBoxButtonState = false;
- DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION );
+ checkBoxButton.SetSelected( true );
- checkBoxButton.SetCheckedImage( image02 );
+ DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+ DALI_TEST_CHECK( gCheckBoxButtonState );
- application.SendNotification();
- application.Render();
+ checkBoxButton.SetSelected( false );
- size = checkBoxButton.GetCheckedImage().GetCurrentSize();
+ DALI_TEST_CHECK( !checkBoxButton.IsSelected() );
+ DALI_TEST_CHECK( !gCheckBoxButtonState );
- DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION );
+ checkBoxButton.SetSelected( true );
- checkBoxButton.SetCheckedImage( imageActor02 );
+ DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+ DALI_TEST_CHECK( gCheckBoxButtonState );
+ END_TEST;
+}
- application.SendNotification();
- application.Render();
+int UtcDaliCheckBoxSetLabelP(void)
+{
+ TestApplication application;
- size = checkBoxButton.GetCheckedImage().GetCurrentSize();
+ CheckBoxButton checkBox = CheckBoxButton::New();
- DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION );
+ Property::Map propertyMap;
+ propertyMap.Insert("text", "activate");
+ checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
- checkBoxButton.SetDisabledBackgroundImage( image03 );
+ DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION ); // Change to use GerProperty once that code is implemented
- application.SendNotification();
- application.Render();
+ END_TEST;
+}
- size = checkBoxButton.GetDisabledBackgroundImage().GetCurrentSize();
+int UtcDaliCheckBoxSetLabelDisabledP(void)
+{
+ TestApplication application;
- DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION );
+ CheckBoxButton checkBox = CheckBoxButton::New();
+ Stage::GetCurrent().Add( checkBox );
- checkBoxButton.SetDisabledBackgroundImage( imageActor03 );
+ checkBox.SetSize( Vector2( 20.0f, 20.0f ) );
+ checkBox.SetDisabledBackgroundImage( "Image.jpg" );
application.SendNotification();
application.Render();
- size = checkBoxButton.GetDisabledBackgroundImage().GetCurrentSize();
+ Property::Map propertyMap;
+ propertyMap.Insert("text", "activate");
+ checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), true);
- DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION );
+ checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
- checkBoxButton.SetDisabledCheckedImage( image04 );
+ DALI_TEST_CHECK( checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
+ DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION ); // Change to use GerProperty once that code is implemented
- application.SendNotification();
- application.Render();
+ END_TEST;
+}
- size = checkBoxButton.GetDisabledCheckedImage().GetCurrentSize();
+int UtcDaliCheckBoxSettingDisabled(void)
+{
+ ToolkitTestApplication application;
- DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION );
+ CheckBoxButton checkBox = CheckBoxButton::New();
- checkBoxButton.SetDisabledCheckedImage( imageActor04 );
+ checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), true);
+ DALI_TEST_CHECK( checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
- application.SendNotification();
- application.Render();
+ checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), false);
- size = checkBoxButton.GetDisabledCheckedImage().GetCurrentSize();
+ DALI_TEST_CHECK( !checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
- DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION );
END_TEST;
}