const char* const PROPERTY_NAME_RENDERING_BACKEND = "rendering-backend";
const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholder-text";
+const char* const PROPERTY_NAME_TEXT = "text";
const char* const PROPERTY_NAME_FONT_FAMILY = "font-family";
const char* const PROPERTY_NAME_FONT_STYLE = "font-style";
const char* const PROPERTY_NAME_POINT_SIZE = "point-size";
const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontal-alignment";
const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "vertical-alignment";
-static bool gObjectCreatedCallBackCalled;
+} // namespace
-static void TestCallback(BaseHandle handle)
+int UtcDaliToolkitTextFieldConstructorP(void)
{
- gObjectCreatedCallBackCalled = true;
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldConstructorP");
+ TextField textField;
+ DALI_TEST_CHECK( !textField );
+ END_TEST;
}
-} // namespace
+int UtcDaliToolkitTextFieldNewP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldNewP");
+ TextField textField = TextField::New();
+ DALI_TEST_CHECK( textField );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextFieldDownCastP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldDownCastP");
+ TextField textField1 = TextField::New();
+ BaseHandle object( textField1 );
+
+ TextField textField2 = TextField::DownCast( object );
+ DALI_TEST_CHECK( textField2 );
+
+ TextField textField3 = DownCast< TextField >( object );
+ DALI_TEST_CHECK( textField3 );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextFieldDownCastN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldDownCastN");
+ BaseHandle uninitializedObject;
+ TextField textField1 = TextField::DownCast( uninitializedObject );
+ DALI_TEST_CHECK( !textField1 );
+
+ TextField textField2 = DownCast< TextField >( uninitializedObject );
+ DALI_TEST_CHECK( !textField2 );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextFieldCopyConstructorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldCopyConstructorP");
+ TextField textField = TextField::New();
+ textField.SetProperty( TextField::Property::TEXT, "Test" );
+
+ TextField copy( textField );
+ DALI_TEST_CHECK( copy );
+ DALI_TEST_CHECK( copy.GetProperty<std::string>( TextLabel::Property::TEXT ) == textField.GetProperty<std::string>( TextLabel::Property::TEXT ) );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextFieldAssignmentOperatorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldAssignmentOperatorP");
+ TextField textField = TextField::New();
+ textField.SetProperty( TextField::Property::TEXT, "Test" );
+
+ TextField copy = textField;
+ DALI_TEST_CHECK( copy );
+ DALI_TEST_CHECK( copy.GetProperty<std::string>( TextField::Property::TEXT ) == textField.GetProperty<std::string>( TextField::Property::TEXT ) );
+ END_TEST;
+}
+
+int UtcDaliTextFieldNewP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldNewP");
+ TextField textField = TextField::New();
+ DALI_TEST_CHECK( textField );
+ END_TEST;
+}
-int UtcDaliTextFieldNew(void)
+int UtcDaliTextFieldGetPropertyN(void)
{
ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldGetPropertyN");
TextField field = TextField::New();
DALI_TEST_CHECK( field );
- //Additional check to ensure object is created by checking if it's registered
- ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
- DALI_TEST_CHECK( registry );
-
- gObjectCreatedCallBackCalled = false;
- registry.ObjectCreatedSignal().Connect(&TestCallback);
+ bool assert = false;
+ try
+ {
+ Property::Value value = field.GetProperty<bool>( 0 );
+ }
+ catch ( ... )
+ {
+ assert = true;
+ }
+ if ( assert )
{
- TextField field = TextField::New();
+ tet_result(TET_PASS);
+ }
+ else
+ {
+ tet_result(TET_FAIL);
}
- DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
END_TEST;
}
-int UtcDaliTextFieldGetSetProperty(void)
+// Positive test case for a method
+int UtcDaliTextFieldGetPropertyP(void)
{
ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldGetPropertyP");
TextField field = TextField::New();
DALI_TEST_CHECK( field );
// Check Property Indices are correct
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextField::Property::RENDERING_BACKEND );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == TextField::Property::PLACEHOLDER_TEXT );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextField::Property::TEXT );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextField::Property::FONT_FAMILY );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextField::Property::FONT_STYLE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextField::Property::POINT_SIZE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_DECORATION_BOUNDING_BOX ) == TextField::Property::DECORATION_BOUNDING_BOX );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextField::Property::HORIZONTAL_ALIGNMENT );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextField::Property::VERTICAL_ALIGNMENT );
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliTextFieldSetPropertyP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldSetPropertyP");
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
// Check exceed policy
field.SetProperty( TextField::Property::EXCEED_POLICY, TextField::EXCEED_POLICY_CLIP );
// Check that the Alignment properties can be correctly set
field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::HORIZONTAL_ALIGNMENT ), "BEGIN", TEST_LOCATION );
- field.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, "TOP" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::VERTICAL_ALIGNMENT ), "TOP", TEST_LOCATION );
+ field.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, "CENTER" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
+
+ // Set text
+ field.SetProperty( TextField::Property::TEXT, "Setting Text" );
+
+ // Set placeholder text (currently not implemented)
+ field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Setting Text" );
+
+ // Set Grab Handle image
+ field.SetProperty( TextField::Property::GRAB_HANDLE_IMAGE, "" );
+
+ END_TEST;
+}
+
+// Negative test case for a method
+int UtcDaliTextFieldSetPropertyN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldSetPropertyN");
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+ bool assert = false;
+ try
+ {
+ field.SetProperty( 0, true );
+ }
+ catch ( ... )
+ {
+ assert = true;
+ }
+ if ( assert )
+ {
+ tet_result(TET_PASS);
+ }
+ else
+ {
+ tet_result(TET_FAIL);
+ }
END_TEST;
}
-int utcDaliTextFieldBasicRender(void)
+// Positive Basic Text Renderer test
+int utcDaliTextFieldBasicRenderP(void)
{
ToolkitTestApplication application;
+ tet_infoline("UtcDaliToolkitTextFieldBasicRenderP");
TextField field = TextField::New();
DALI_TEST_CHECK( field );
END_TEST;
}
-int utcDaliTextFieldAtlasRender(void)
+// Positive Atlas Text Renderer test
+int utcDaliTextFieldAtlasRenderP(void)
{
ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldAtlasRenderP");
+ StyleManager styleManager = StyleManager::Get();
+ styleManager.RequestDefaultTheme();
TextField field = TextField::New();
DALI_TEST_CHECK( field );
const char* const PROPERTY_NAME_SHADOW_COLOR = "shadow-color";
const char* const PROPERTY_NAME_UNDERLINE_ENABLED = "underline-enabled";
const char* const PROPERTY_NAME_UNDERLINE_COLOR = "underline-color";
+const char* const PROPERTY_NAME_UNDERLINE_HEIGHT = "underline-height";
-static bool gObjectCreatedCallBackCalled;
+} // namespace
-static void TestCallback(BaseHandle handle)
+int UtcDaliToolkitTextLabelConstructorP(void)
{
- gObjectCreatedCallBackCalled = true;
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelConstructorP");
+ TextLabel textLabel;
+ DALI_TEST_CHECK( !textLabel );
+ END_TEST;
}
-} // namespace
+int UtcDaliToolkitTextLabelNewP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelNewP");
+ TextLabel textLabel = TextLabel::New( "Test Text" );
+ DALI_TEST_CHECK( textLabel );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelDownCastP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelDownCastP");
+ TextLabel textLabel1 = TextLabel::New();
+ BaseHandle object( textLabel1 );
+
+ TextLabel textLabel2 = TextLabel::DownCast( object );
+ DALI_TEST_CHECK( textLabel2 );
+
+ TextLabel textLabel3 = DownCast< TextLabel >( object );
+ DALI_TEST_CHECK( textLabel3 );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelDownCastN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelDownCastN");
+ BaseHandle uninitializedObject;
+ TextLabel textLabel1 = TextLabel::DownCast( uninitializedObject );
+ DALI_TEST_CHECK( !textLabel1 );
-int UtcDaliTextLabelNew(void)
+ TextLabel textLabel2 = DownCast< TextLabel >( uninitializedObject );
+ DALI_TEST_CHECK( !textLabel2 );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelCopyConstructorP(void)
{
ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelCopyConstructorP");
+ TextLabel textLabel = TextLabel::New();
+ textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
+
+ TextLabel copy( textLabel );
+ DALI_TEST_CHECK( copy );
+ DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelAssignmentOperatorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelAssingmentOperatorP");
+ TextLabel textLabel = TextLabel::New();
+ textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
+
+ TextLabel copy = textLabel;
+ DALI_TEST_CHECK( copy );
+ DALI_TEST_CHECK( copy.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) == textLabel.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ) );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelGetPropertyN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelGetPropertyN");
TextLabel label = TextLabel::New("Test Text");
DALI_TEST_CHECK( label );
- //Additional check to ensure object is created by checking if it's registered
- ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
- DALI_TEST_CHECK( registry );
-
- gObjectCreatedCallBackCalled = false;
- registry.ObjectCreatedSignal().Connect(&TestCallback);
+ bool assert = false;
+ try
+ {
+ Property::Value value = label.GetProperty<bool>( 0 );
+ }
+ catch ( ... )
+ {
+ assert = true;
+ }
+ if ( assert )
{
- TextLabel label = TextLabel::New("Test Text");
+ tet_result(TET_PASS);
+ }
+ else
+ {
+ tet_result(TET_FAIL);
}
- DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
END_TEST;
}
-int UtcDaliTextLabelGetSetProperty(void)
+// Positive test case for a method
+int UtcDaliToolkitTextLabelGetPropertyP(void)
{
ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelGetPropertyP");
TextLabel label = TextLabel::New("Test Text");
DALI_TEST_CHECK( label );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW_COLOR ) == TextLabel::Property::SHADOW_COLOR );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE_ENABLED ) == TextLabel::Property::UNDERLINE_ENABLED );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE_COLOR ) == TextLabel::Property::UNDERLINE_COLOR );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE_HEIGHT) == TextLabel::Property::UNDERLINE_HEIGHT );
// Check label defaults are correct
DALI_TEST_EQUALS( label.GetProperty<int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
DALI_TEST_EQUALS( label.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ), Vector2::ZERO, TEST_LOCATION );
DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::SHADOW_COLOR ), Vector4::ZERO, TEST_LOCATION );
DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::UNDERLINE_ENABLED ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::UNDERLINE_HEIGHT ), 0.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelSetPropertyN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelSetPropertyN");
+ TextLabel label = TextLabel::New("Test Text");
+ DALI_TEST_CHECK( label );
+
+ bool assert = false;
+ try
+ {
+ label.SetProperty( 0, true );
+ }
+ catch ( ... )
+ {
+ assert = true;
+ }
+ if ( assert )
+ {
+ tet_result(TET_PASS);
+ }
+ else
+ {
+ tet_result(TET_FAIL);
+ }
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelSetPropertyP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelSetPropertyP");
+ TextLabel label = TextLabel::New("Test Text");
+ DALI_TEST_CHECK( label );
// Check that text can be correctly reset
label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::UNDERLINE_ENABLED ), true, TEST_LOCATION );
label.SetProperty( TextLabel::Property::UNDERLINE_COLOR, Color::RED );
DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::UNDERLINE_COLOR ), Color::RED, TEST_LOCATION );
+ label.SetProperty( TextLabel::Property::UNDERLINE_HEIGHT, 1.0f );
+ DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::UNDERLINE_HEIGHT ), 1.0f, TEST_LOCATION );
+
+ // Check that text color can be properly set
+ label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
+ DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
// Toggle multi-line
label.SetProperty( TextLabel::Property::MULTI_LINE, true );
END_TEST;
}
-int utcDaliTextlabelBasicRender(void)
+int UtcDaliToolkitTextlabelBasicRenderP(void)
{
ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelBasicRenderP");
TextLabel label = TextLabel::New("Test Text");
DALI_TEST_CHECK( label );
END_TEST;
}
-int utcDaliTextlabelAtlasRender(void)
+int UtcDaliToolkitTextlabelAtlasRenderP(void)
{
ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelAtlasRenderP");
TextLabel label = TextLabel::New("Test Text");
DALI_TEST_CHECK( label );