Revert "[Tizen] Text style to return properties(FONT_STYLE) as string" 84/131784/1
authorJinho, Lee <jeano.lee@samsung.com>
Tue, 30 May 2017 09:20:26 +0000 (18:20 +0900)
committerJinho, Lee <jeano.lee@samsung.com>
Tue, 30 May 2017 09:20:28 +0000 (18:20 +0900)
This reverts commit 580a3a5de8489adb3ad6d0fcc2802c1a5b00a1c1.

Change-Id: Ie104d6ca204c6c353122bc67035fd89f3d930221

automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/text/text-font-style.cpp

index 5cacd19..ff32ccf 100644 (file)
@@ -1913,25 +1913,3 @@ int utcDaliTextEditorShadowPropertyStringP(void)
 
   END_TEST;
 }
-
-int utcDaliTextEditorFontStylePropertyStringP(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" utcDaliTextEditorFontStylePropertyStringP Setting FontStyle propeties by string");
-
-  TextEditor editor = TextEditor::New();
-
-  std::string fontStyleSettings( "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
-
-  Stage::GetCurrent().Add( editor );
-
-  editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
-
-  Property::Value value = editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE );
-  std::string result;
-  value.Get(result);
-
-  DALI_TEST_EQUALS( result, fontStyleSettings, TEST_LOCATION );
-
-  END_TEST;
-}
index 3014edb..43a7cf3 100644 (file)
@@ -316,8 +316,7 @@ struct Controller::Impl
     mIsAutoScrollEnabled( false ),
     mAutoScrollDirectionRTL( false ),
     mUnderlineSetByString( false ),
-    mShadowSetByString( false ),
-    mFontStyleSetByString( false )
+    mShadowSetByString( false )
   {
     mModel = Model::New();
 
@@ -726,7 +725,6 @@ public:
 
   bool mUnderlineSetByString:1;            ///< Set when underline is set by string (legacy) instead of map
   bool mShadowSetByString:1;               ///< Set when shadow is set by string (legacy) instead of map
-  bool mFontStyleSetByString:1;            ///< Set when font style is set by string (legacy) instead of map
 };
 
 } // namespace Text
index 4724744..7545481 100644 (file)
@@ -1438,16 +1438,6 @@ void Controller::ShadowSetByString( bool setByString )
   mImpl->mShadowSetByString = setByString;
 }
 
-bool Controller::IsFontStyleSetByString()
-{
-  return mImpl->mFontStyleSetByString;
-}
-
-void Controller::FontStyleSetByString( bool setByString )
-{
-  mImpl->mFontStyleSetByString = setByString;
-}
-
 // public : Queries & retrieves.
 
 Layout::Engine& Controller::GetLayoutEngine()
index 7562394..b9cbb2c 100644 (file)
@@ -422,18 +422,6 @@ public: // Configure the text controller.
    */
   void ShadowSetByString( bool setByString );
 
-  /**
-   * @brief Query if font style settings were provided by string or map
-   * @return bool true if set by string
-   */
-  bool IsFontStyleSetByString();
-
-  /**
-   * Set method font style setting were set by
-   * @param[in] bool, true if set by string
-   */
-  void FontStyleSetByString( bool setByString );
-
 public: // Update.
 
   /**
index 249157e..6a57337 100644 (file)
@@ -114,13 +114,10 @@ void SetFontStyleProperty( ControllerPtr controller, const Property::Value& valu
       const std::string& fontStyleProperties = value.Get<std::string>();
 
       ParsePropertyString( fontStyleProperties, map );
-      controller->FontStyleSetByString( true );
-
     }
     else
     {
       map = value.Get<Property::Map>();
-      controller->FontStyleSetByString( false );
     }
 
     if( !map.Empty() )
@@ -246,7 +243,6 @@ void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, Fon
   if( controller )
   {
     const bool isDefaultStyle = FontStyle::DEFAULT == type;
-    const bool isSetbyString = controller->IsFontStyleSetByString();
 
     bool weightDefined = false;
     bool widthDefined = false;
@@ -298,97 +294,46 @@ void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, Fon
       }
     }
 
-    if( !isSetbyString )
-    {
-      Property::Map map;
-
-      if( weightDefined )
-      {
-        if( TextAbstraction::FontWeight::NONE != weight )
-        {
-          const std::string weightStr( GetEnumerationName( weight,
-                                                          FONT_WEIGHT_STRING_TABLE,
-                                                          FONT_WEIGHT_STRING_TABLE_COUNT ) );
-
-          map.Insert( WEIGHT_KEY, weightStr );
-        }
-      }
-
-      if( widthDefined )
-      {
-        if( TextAbstraction::FontWidth::NONE != width )
-        {
-          const std::string widthStr( GetEnumerationName( width,
-                                                          FONT_WIDTH_STRING_TABLE,
-                                                          FONT_WIDTH_STRING_TABLE_COUNT ) );
-
-          map.Insert( WIDTH_KEY, widthStr );
-        }
-      }
+    Property::Map map;
 
-      if( slantDefined )
+    if( weightDefined )
+    {
+      if( TextAbstraction::FontWeight::NONE != weight )
       {
-        if( TextAbstraction::FontSlant::NONE != slant )
-        {
-          const std::string slantStr( GetEnumerationName( slant,
-                                                          FONT_SLANT_STRING_TABLE,
-                                                          FONT_SLANT_STRING_TABLE_COUNT ) );
+        const std::string weightStr( GetEnumerationName( weight,
+                                                         FONT_WEIGHT_STRING_TABLE,
+                                                         FONT_WEIGHT_STRING_TABLE_COUNT ) );
 
-          map.Insert( SLANT_KEY, slantStr );
-        }
+        map.Insert( WEIGHT_KEY, weightStr );
       }
+    }
 
-      value = map;
-    } // SetbyMAP
-    else
+    if( widthDefined )
     {
-      std::string fontStyleProperties = "{";
-
-      if( weightDefined )
+      if( TextAbstraction::FontWidth::NONE != width )
       {
-        if( TextAbstraction::FontWeight::NONE != weight )
-        {
-          const std::string weightStr( GetEnumerationName( weight,
-                                                          FONT_WEIGHT_STRING_TABLE,
-                                                          FONT_WEIGHT_STRING_TABLE_COUNT ) );
+        const std::string widthStr( GetEnumerationName( width,
+                                                        FONT_WIDTH_STRING_TABLE,
+                                                        FONT_WIDTH_STRING_TABLE_COUNT ) );
 
-          fontStyleProperties += "\"weight\":\"" + weightStr + "\",";
-        }
-      }
-
-      if( widthDefined )
-      {
-        if( TextAbstraction::FontWidth::NONE != width )
-        {
-          const std::string widthStr( GetEnumerationName( width,
-                                                          FONT_WIDTH_STRING_TABLE,
-                                                          FONT_WIDTH_STRING_TABLE_COUNT ) );
-          fontStyleProperties += "\"width\":\"" + widthStr + "\",";
-        }
+        map.Insert( WIDTH_KEY, widthStr );
       }
+    }
 
-      if( slantDefined )
+    if( slantDefined )
+    {
+      if( TextAbstraction::FontSlant::NONE != slant )
       {
-        if( TextAbstraction::FontSlant::NONE != slant )
-        {
-          const std::string slantStr( GetEnumerationName( slant,
-                                                          FONT_SLANT_STRING_TABLE,
-                                                          FONT_SLANT_STRING_TABLE_COUNT ) );
-
-          fontStyleProperties += "\"slant\":\"" + slantStr + "\"";
-        }
-      }
+        const std::string slantStr( GetEnumerationName( slant,
+                                                        FONT_SLANT_STRING_TABLE,
+                                                        FONT_SLANT_STRING_TABLE_COUNT ) );
 
-      // If last character is comma, it will be removed.
-      if((*fontStyleProperties.rbegin()) == ',' )
-      {
-        fontStyleProperties = fontStyleProperties.substr( 0, fontStyleProperties.size()-1 );
+        map.Insert( SLANT_KEY, slantStr );
       }
-      fontStyleProperties += "}";
+    }
 
-      value = fontStyleProperties;
-    } // SetbyString
-  }// controller
+    value = map;
+  }
 }
 
 FontWeight StringToWeight( const char* const weightStr )