Control dummy = Control::New();
Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy );
- // test that style manager is being used, passing an empty handle throws exception
- try
- {
- Dali::Toolkit::StyleManager styleManager;
- controlImpl.OnStyleChange( styleManager, StyleChange::THEME_CHANGE );
- tet_result(TET_FAIL);
- }
- catch (DaliException &exception)
- {
- tet_result(TET_PASS);
- }
+ // test that style manager is being used, passing an empty handle does nothing but does not crash either
+ Dali::Toolkit::StyleManager styleManager;
+ controlImpl.OnStyleChange( styleManager, StyleChange::THEME_CHANGE );
+ // no crash so test passes
+ tet_result(TET_PASS);
END_TEST;
}
// Test "rows" property
DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_ROWS ) == TableView::Property::ROWS );
- tableView.SetProperty( TableView::Property::ROWS, 4u );
+ tableView.SetProperty( TableView::Property::ROWS, 4 );
DALI_TEST_CHECK( tableView.GetRows() == 4u );
- DALI_TEST_CHECK( tableView.GetProperty(TableView::Property::ROWS).Get<unsigned int>() == 4u );
+ DALI_TEST_CHECK( tableView.GetProperty(TableView::Property::ROWS).Get<int>() == 4 );
// Test "columns" property
DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_COLUMNS ) == TableView::Property::COLUMNS );
- tableView.SetProperty( TableView::Property::COLUMNS, 5u );
+ tableView.SetProperty( TableView::Property::COLUMNS, 5 );
DALI_TEST_CHECK( tableView.GetColumns() == 5u );
- DALI_TEST_CHECK( tableView.GetProperty(TableView::Property::COLUMNS).Get<unsigned int>() == 5u );
+ DALI_TEST_CHECK( tableView.GetProperty(TableView::Property::COLUMNS).Get<int>() == 5 );
// Test "cell-padding" property
DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_CELL_PADDING ) == TableView::Property::CELL_PADDING );
const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX = "decoration-bounding-box";
const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "input-method-settings";
-const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f );
const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
DALI_TEST_CHECK( field );
// Check defaults.
- DALI_TEST_EQUALS( field.GetProperty<unsigned int>( TextField::Property::RENDERING_BACKEND ), DEFAULT_RENDERING_BACKEND, TEST_LOCATION );
+ DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::RENDERING_BACKEND ), DEFAULT_RENDERING_BACKEND, TEST_LOCATION );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string(""), TEST_LOCATION );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::PLACEHOLDER_TEXT ), std::string(""), TEST_LOCATION );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::PLACEHOLDER_TEXT_FOCUSED ), std::string(""), TEST_LOCATION );
// Check the render backend property.
field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
- DALI_TEST_EQUALS( field.GetProperty<unsigned int>( TextField::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
+ DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
// Check text property.
field.SetProperty( TextField::Property::TEXT, "Setting Text" );
const char* const PROPERTY_NAME_UNDERLINE_COLOR = "underline-color";
const char* const PROPERTY_NAME_UNDERLINE_HEIGHT = "underline-height";
-const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
} // namespace
DALI_TEST_CHECK( label );
// Check defaults
- DALI_TEST_EQUALS( label.GetProperty<unsigned int>( TextLabel::Property::RENDERING_BACKEND ), DEFAULT_RENDERING_BACKEND, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty<int>( TextLabel::Property::RENDERING_BACKEND ), DEFAULT_RENDERING_BACKEND, TEST_LOCATION );
DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), std::string(""), TEST_LOCATION );
DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string(""), TEST_LOCATION );
DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::UNDERLINE_HEIGHT ), 0.0f, TEST_LOCATION );
label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
- DALI_TEST_EQUALS( label.GetProperty<unsigned int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty<int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
// Check that text can be correctly reset
label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
ret = ToString( value.Get<int>() );
break;
}
- case Property::UNSIGNED_INTEGER:
- {
- ret = ToString( value.Get<unsigned int>() );
- break;
- }
case Property::VECTOR2:
{
ret = ToString( value.Get<Vector2>() );
}
break;
}
- case Property::UNSIGNED_INTEGER:
- {
- if( OptionalUnsignedInt v = replacer.IsUnsignedInteger( node) )
- {
- value = *v;
- done = true;
- }
- break;
- }
case Property::VECTOR2:
{
if( OptionalVector2 v = replacer.IsVector2(node) )
return ret;
}
-OptionalUnsignedInt Replacement::IsUnsignedInteger( const TreeNode & node ) const
-{
- OptionalUnsignedInt ret;
- if( OptionalString replace = HasFullReplacement( node ) )
- {
- Property::Value value = GetFullReplacement( *replace );
- if( Property::UNSIGNED_INTEGER == value.GetType() )
- {
- ret = value.Get<unsigned int>();
- }
- }
- else
- {
- if ( OptionalInteger i = ::IsInteger( node ) )
- {
- ret = OptionalUnsignedInt(static_cast<unsigned int>(*i) );
- }
- }
- return ret;
-}
-
OptionalVector2 Replacement::IsVector2( const TreeNode & node ) const
{
OptionalVector2 ret;
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalUnsignedInt IsUnsignedInteger( const TreeNode & node ) const;
-
- /* @brief Check node for a type
- *
- * @param node The TreeNode to check
- * @return Optional value
- */
OptionalVector2 IsVector2( const TreeNode & node ) const;
/* @brief Check node for a type
vertices.SetData( &vertexData[0] );
Property::Map indexFormat;
- indexFormat["indices"] = Property::UNSIGNED_INTEGER;
+ indexFormat["indices"] = Property::INTEGER;
PropertyBuffer indices = PropertyBuffer::New( indexFormat, numIndex );
indices.SetData( &indexData[0] );
{
if( !mTogglableButton )
{
- Toolkit::Button handle( GetOwner() );
-
Pressed();
if( mAutoRepeating )
{
SetUpTimer( mInitialAutoRepeatingDelay );
}
-
- //Emit signal.
- mPressedSignal.Emit( handle );
}
+
+ // The pressed signal should be emitted regardless of toggle mode.
+ Toolkit::Button handle( GetOwner() );
+ mPressedSignal.Emit( handle );
}
void Button::OnButtonUp()
{
mAutoRepeatingTimer.Reset();
}
-
- Toolkit::Button handle( GetOwner() );
-
- //Emit signal.
- mReleasedSignal.Emit( handle );
- mClickedSignal.Emit( handle );
}
+
+ // The clicked and released signals should be emitted regardless of toggle mode.
+ Toolkit::Button handle( GetOwner() );
+ mReleasedSignal.Emit( handle );
+ mClickedSignal.Emit( handle );
}
}
{
if( !mTogglableButton )
{
- Toolkit::Button handle( GetOwner() );
-
Released();
if( mAutoRepeating )
{
mAutoRepeatingTimer.Reset();
}
-
- //Emit signal.
- mReleasedSignal.Emit( handle );
}
+
+ // The released signal should be emitted regardless of toggle mode.
+ Toolkit::Button handle( GetOwner() );
+ mReleasedSignal.Emit( handle );
}
}
unsigned int indexData[18] = { 0,3,1,0,2,3,4,7,5,4,6,7,8,11,9,8,10,11 };
Property::Map indexFormat;
- indexFormat["indices"] = Property::UNSIGNED_INTEGER;
+ indexFormat["indices"] = Property::INTEGER;
PropertyBuffer indices = PropertyBuffer::New( indexFormat, 18u );
indices.SetData( indexData );
// Setup properties, signals and actions using the type-registry.
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TableView, Toolkit::Control, Create );
-DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "rows", UNSIGNED_INTEGER, ROWS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "columns", UNSIGNED_INTEGER, COLUMNS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "cell-padding", VECTOR2, CELL_PADDING )
-DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "layout-rows", MAP, LAYOUT_ROWS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "layout-columns", MAP, LAYOUT_COLUMNS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "rows", INTEGER, ROWS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "columns", INTEGER, COLUMNS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "cell-padding", VECTOR2, CELL_PADDING )
+DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "layout-rows", MAP, LAYOUT_ROWS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TableView, "layout-columns", MAP, LAYOUT_COLUMNS )
DALI_TYPE_REGISTRATION_END()
{
case Toolkit::TableView::Property::ROWS:
{
- if( value.Get<unsigned int>() != tableViewImpl.GetRows() )
+ int rows = 0;
+ if( value.Get( rows ) && rows >= 0 )
{
- tableViewImpl.Resize( value.Get<unsigned int>(), tableViewImpl.GetColumns() );
+ if( static_cast<unsigned int>(rows) != tableViewImpl.GetRows() )
+ {
+ tableViewImpl.Resize( rows, tableViewImpl.GetColumns() );
+ }
}
break;
}
case Toolkit::TableView::Property::COLUMNS:
{
- if( value.Get<unsigned int>() != tableViewImpl.GetColumns() )
+ int columns = 0;
+ if( value.Get( columns ) && columns >= 0 )
{
- tableViewImpl.Resize( tableViewImpl.GetRows(), value.Get<unsigned int>() );
+ if( static_cast<unsigned int>( columns ) != tableViewImpl.GetColumns() )
+ {
+ tableViewImpl.Resize( tableViewImpl.GetRows(), value.Get<int>() );
+ }
}
break;
}
{
case Toolkit::TableView::Property::ROWS:
{
- value = tableViewImpl.GetRows();
+ value = static_cast<int>( tableViewImpl.GetRows() );
break;
}
case Toolkit::TableView::Property::COLUMNS:
{
- value = tableViewImpl.GetColumns();
+ value = static_cast<int>( tableViewImpl.GetColumns() );
break;
}
case Toolkit::TableView::Property::CELL_PADDING:
mNotifyEndOfScroll( false )
{
mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
- mQuadIndexFormat[ "indices" ] = Property::UNSIGNED_INTEGER;
+ mQuadIndexFormat[ "indices" ] = Property::INTEGER;
mHighlightMaterial = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
}
// Get the glyph info.
const GlyphInfo& glyphInfo = *( parameters.glyphsBuffer + glyphIndex );
+ // Check if the font of the current glyph is the same of the previous one.
+ // If it's different the ascender and descender need to be updated.
+ if( lastFontId != glyphInfo.fontId )
+ {
+ UpdateLineHeight( glyphInfo.fontId, tmpLineLayout );
+ lastFontId = glyphInfo.fontId;
+ }
+
// Get the character indices for the current glyph. The last character index is needed
// because there are glyphs formed by more than one character but their break info is
// given only for the last character.
tmpLineLayout.Clear();
}
- // Check if the font of the current glyph is the same of the previous one.
- // If it's different the ascender and descender need to be updated.
- if( lastFontId != glyphInfo.fontId )
- {
- UpdateLineHeight( glyphInfo.fontId, tmpLineLayout );
- lastFontId = glyphInfo.fontId;
- }
-
previousCharacterDirection = characterDirection;
}
mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
mQuadVertexFormat[ "aTexCoord" ] = Property::VECTOR2;
- mQuadIndexFormat[ "indices" ] = Property::UNSIGNED_INTEGER;
+ mQuadIndexFormat[ "indices" ] = Property::INTEGER;
}
void AddGlyphs( const std::vector<Vector2>& positions,
//Create the index buffer
Property::Map indexFormat;
- indexFormat["indices"] = Property::UNSIGNED_INTEGER;
+ indexFormat["indices"] = Property::INTEGER;
PropertyBuffer indexBuffer = PropertyBuffer::New( indexFormat, 6u );
indexBuffer.SetData(gQuadIndex);
void Control::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
{
// By default the control is only interested in theme (not font) changes
- if( change == StyleChange::THEME_CHANGE )
+ if( styleManager && change == StyleChange::THEME_CHANGE )
{
GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
}
{
case Dali::Property::BOOLEAN:
case Dali::Property::INTEGER:
- case Dali::Property::UNSIGNED_INTEGER:
case Dali::Property::STRING:
case Dali::Property::FLOAT:
{
v8Value = v8::Integer::New( isolate, value.Get<int>());
break;
}
- case Dali::Property::UNSIGNED_INTEGER:
- {
- v8Value = v8::Integer::New( isolate, value.Get<unsigned int>());
- break;
- }
case Dali::Property::STRING:
{
std::string string = value.Get< std::string >();
}
break;
}
- case Dali::Property::UNSIGNED_INTEGER:
- {
- if( v8Value->IsUint32() )
- {
- daliPropertyValue = Dali::Property::Value( v8Value->Uint32Value() );//static_cast<unsigned int>( V8Utils::GetNumberValue( isolate, v8Value) ));
- }
- break;
- }
case Dali::Property::STRING:
{
if( V8Utils::IsStringPrimitiveOrObject( v8Value) )
v8::Local<v8::Number> v = value->ToNumber();
return Dali::Property::Value(static_cast<float>(v->Value()));
}
- else if( value->IsInt32() )
+ else if( value->IsInt32() || value->IsUint32() )
{
found = true;
v8::Local<v8::Int32> v = value->ToInt32();
return Dali::Property::Value(static_cast<int>(v->Value()));
}
- else if ( value->IsUint32() )
- {
- found = true;
- v8::Local<v8::Uint32> v = value->ToUint32();
- return Dali::Property::Value(static_cast<unsigned int>(v->Value()));
- }
return daliPropertyValue;
}
v8Value = v8::Integer::New( isolate, value.Get<int>());
break;
}
- case Dali::Property::UNSIGNED_INTEGER:
- {
- v8Value = v8::Integer::New( isolate, value.Get<unsigned int>());
- break;
- }
case Dali::Property::STRING:
{
std::string string = value.Get< std::string >();