Merge "Remove UNSIGNED_INTEGER property type (removed from core)" into devel/master
authorPaul Wisbey <p.wisbey@samsung.com>
Thu, 9 Jul 2015 14:40:34 +0000 (07:40 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 9 Jul 2015 14:40:35 +0000 (07:40 -0700)
16 files changed:
automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp
automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
dali-toolkit/internal/builder/builder-impl.cpp
dali-toolkit/internal/builder/builder-set-property.cpp
dali-toolkit/internal/builder/replacement.cpp
dali-toolkit/internal/builder/replacement.h
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
dali-toolkit/internal/controls/table-view/table-view-impl.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/public-api/controls/control-impl.cpp
plugins/dali-script-v8/src/object/property-value-wrapper.cpp
plugins/dali-script-v8/src/utils/v8-utils.cpp

index daac903..1180731 100644 (file)
@@ -867,17 +867,11 @@ int UtcDaliControlImplOnStyleChangeN(void)
   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;
 }
index 9c1e054..14d183b 100644 (file)
@@ -595,18 +595,18 @@ int UtcDaliTableViewSetGetProperty(void)
   // 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 );
index 7e6b21e..1c3f5f1 100644 (file)
@@ -72,7 +72,7 @@ const char* const PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR            = "selectio
 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.
@@ -268,7 +268,7 @@ int UtcDaliTextFieldSetPropertyP(void)
   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 );
@@ -294,7 +294,7 @@ int UtcDaliTextFieldSetPropertyP(void)
 
   // 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" );
index 21b3c8b..f295b33 100644 (file)
@@ -51,7 +51,7 @@ 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";
 
-const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
 
 } // namespace
 
@@ -162,7 +162,7 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   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 );
@@ -178,7 +178,7 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   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" );
index 0371491..07ca895 100644 (file)
@@ -124,11 +124,6 @@ std::string PropertyValueToString( const Property::Value& value )
       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>() );
index a1ed104..12f602c 100644 (file)
@@ -208,15 +208,6 @@ bool SetPropertyFromNode( const TreeNode& node, Property::Type type, Property::V
       }
       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) )
index 49e7365..446a014 100644 (file)
@@ -321,27 +321,6 @@ OptionalInteger Replacement::IsInteger( const TreeNode & node ) const
   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;
index 358c21c..3c4d829 100644 (file)
@@ -102,13 +102,6 @@ public:
    * @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
index af57a7f..a9b9aa9 100644 (file)
@@ -322,7 +322,7 @@ Geometry BubbleEmitter::CreateGeometry( unsigned int numOfPatch )
   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] );
 
index d278eb4..89eb96e 100644 (file)
@@ -102,7 +102,7 @@ Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
 
   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 );
 
index 0be26cd..ae35484 100644 (file)
@@ -142,11 +142,11 @@ BaseHandle Create()
 // 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()
 
@@ -877,17 +877,25 @@ void TableView::SetProperty( BaseObject* object, Property::Index index, const Pr
     {
       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;
       }
@@ -923,12 +931,12 @@ Property::Value TableView::GetProperty( BaseObject* object, Property::Index inde
     {
       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:
index 43867b4..a22cc90 100644 (file)
@@ -281,7 +281,7 @@ struct Decorator::Impl : public ConnectionTracker
     mNotifyEndOfScroll( false )
   {
     mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
-    mQuadIndexFormat[ "indices" ] = Property::UNSIGNED_INTEGER;
+    mQuadIndexFormat[ "indices" ] = Property::INTEGER;
     mHighlightMaterial = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
   }
 
index 9d34fd2..a9810c9 100644 (file)
@@ -104,7 +104,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
 
     mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
     mQuadVertexFormat[ "aTexCoord" ] = Property::VECTOR2;
-    mQuadIndexFormat[ "indices" ] = Property::UNSIGNED_INTEGER;
+    mQuadIndexFormat[ "indices" ] = Property::INTEGER;
   }
 
   void AddGlyphs( const std::vector<Vector2>& positions,
index c0c71ea..74eabcb 100644 (file)
@@ -239,7 +239,7 @@ Actor CreateBackground( Actor parent, const Vector4& color, Image image = Image(
 
     //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);
 
@@ -900,7 +900,7 @@ void Control::OnControlChildRemove( Actor& child )
 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() ) );
   }
index c58d991..0b70084 100644 (file)
@@ -481,7 +481,6 @@ bool IsPrimitive( const Dali::Property::Value &value )
   {
     case Dali::Property::BOOLEAN:
     case Dali::Property::INTEGER:
-    case Dali::Property::UNSIGNED_INTEGER:
     case Dali::Property::STRING:
     case Dali::Property::FLOAT:
     {
@@ -516,11 +515,6 @@ v8::Local<v8::Object> CreateJavaScriptPrimitive( v8::Isolate* isolate, const Dal
        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 >();
@@ -683,14 +677,6 @@ Dali::Property::Value PropertyValueWrapper::ExtractPropertyValue( v8::Isolate* i
       }
       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) )
index 697b9dd..3466198 100644 (file)
@@ -422,18 +422,12 @@ Property::Value GetPropertyValueFromObject( bool& found, v8::Isolate* isolate, c
     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;
 
 }
@@ -894,11 +888,6 @@ void CreatePropertyMap( v8::Isolate* isolate, const Property::Map& map, v8::Loca
         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 >();