Add Get/Set background info to Style 26/208026/6
authorhyunho <hhstark.kang@samsung.com>
Mon, 17 Jun 2019 07:36:55 +0000 (16:36 +0900)
committerhyunho <hhstark.kang@samsung.com>
Thu, 20 Jun 2019 01:20:34 +0000 (10:20 +0900)
Change-Id: I97d5cd4b6c7dfe0462e7f6c695c0739a1153c9d5
Signed-off-by: hyunho <hhstark.kang@samsung.com>
notification-ex/abstract_item.cc
notification-ex/abstract_item.h
notification-ex/abstract_item_implementation.h
notification-ex/stub.cc
unittest/src/test_abstract_item.cc

index f5206b9..c24cd17 100644 (file)
 #define ABSTRACT_ITEM_STYLE_COLOR_R_KEY "__ABSTRACT_ITEM_STYLE_COLOR_R_KEY__"
 #define ABSTRACT_ITEM_STYLE_COLOR_G_KEY "__ABSTRACT_ITEM_STYLE_COLOR_G_KEY__"
 #define ABSTRACT_ITEM_STYLE_COLOR_B_KEY "__ABSTRACT_ITEM_STYLE_COLOR_B_KEY__"
+#define ABSTRACT_ITEM_STYLE_BG_COLOR_A_KEY "__ABSTRACT_ITEM_STYLE_BG_COLOR_A_KEY__"
+#define ABSTRACT_ITEM_STYLE_BG_COLOR_R_KEY "__ABSTRACT_ITEM_STYLE_BG_COLOR_R_KEY__"
+#define ABSTRACT_ITEM_STYLE_BG_COLOR_G_KEY "__ABSTRACT_ITEM_STYLE_BG_COLOR_G_KEY__"
+#define ABSTRACT_ITEM_STYLE_BG_COLOR_B_KEY "__ABSTRACT_ITEM_STYLE_BG_COLOR_B_KEY__"
+#define ABSTRACT_ITEM_STYLE_BG_IMAGE_PATH_KEY "__ABSTRACT_ITEM_STYLE_BG_IMAGE_PATH_KEY__"
 #define ABSTRACT_ITEM_STYLE_GEOMETRY_X_KEY "__ABSTRACT_ITEM_STYLE_GEOMETRY_X_KEY__"
 #define ABSTRACT_ITEM_STYLE_GEOMETRY_Y_KEY "__ABSTRACT_ITEM_STYLE_GEOMETRY_Y_KEY__"
 #define ABSTRACT_ITEM_STYLE_GEOMETRY_WIDTH_KEY "__ABSTRACT_ITEM_STYLE_GEOMETRY_WIDTH_KEY__"
@@ -175,28 +180,51 @@ Bundle AbstractItem::Serialize() const {
   }
 
   if (impl_->style_ != nullptr) {
-    Padding padding = impl_->style_->GetPadding();
-    b.Add(ABSTRACT_ITEM_STYLE_PADDING_LEFT_KEY, to_string(padding.GetLeft()));
-    b.Add(ABSTRACT_ITEM_STYLE_PADDING_TOP_KEY, to_string(padding.GetTop()));
-    b.Add(ABSTRACT_ITEM_STYLE_PADDING_RIGHT_KEY, to_string(padding.GetRight()));
-    b.Add(ABSTRACT_ITEM_STYLE_PADDING_BOTTOM_KEY, to_string(padding.GetBottom()));
-
-    Color color = impl_->style_->GetColor();
-    b.Add(ABSTRACT_ITEM_STYLE_COLOR_A_KEY,
-        to_string(static_cast<int>(color.GetAVal())));
-    b.Add(ABSTRACT_ITEM_STYLE_COLOR_R_KEY,
-        to_string(static_cast<int>(color.GetRVal())));
-    b.Add(ABSTRACT_ITEM_STYLE_COLOR_G_KEY,
-        to_string(static_cast<int>(color.GetGVal())));
-    b.Add(ABSTRACT_ITEM_STYLE_COLOR_B_KEY,
-        to_string(static_cast<int>(color.GetBVal())));
-
-    Geometry geometry = impl_->style_->GetGeometry();
-    b.Add(ABSTRACT_ITEM_STYLE_GEOMETRY_X_KEY, to_string(geometry.GetX()));
-    b.Add(ABSTRACT_ITEM_STYLE_GEOMETRY_Y_KEY, to_string(geometry.GetY()));
-    b.Add(ABSTRACT_ITEM_STYLE_GEOMETRY_WIDTH_KEY, to_string(geometry.GetWidth()));
-    b.Add(ABSTRACT_ITEM_STYLE_GEOMETRY_HEIGHT_KEY, to_string(geometry.GetHeight()));
+    shared_ptr<Padding> padding = impl_->style_->GetPadding();
+    if (padding.get() != nullptr) {
+      b.Add(ABSTRACT_ITEM_STYLE_PADDING_LEFT_KEY, to_string(padding->GetLeft()));
+      b.Add(ABSTRACT_ITEM_STYLE_PADDING_TOP_KEY, to_string(padding->GetTop()));
+      b.Add(ABSTRACT_ITEM_STYLE_PADDING_RIGHT_KEY,
+          to_string(padding->GetRight()));
+      b.Add(ABSTRACT_ITEM_STYLE_PADDING_BOTTOM_KEY,
+          to_string(padding->GetBottom()));
+    }
+
+    shared_ptr<Color> color = impl_->style_->GetColor();
+    if (color.get() != nullptr) {
+      b.Add(ABSTRACT_ITEM_STYLE_COLOR_A_KEY,
+          to_string(static_cast<int>(color->GetAVal())));
+      b.Add(ABSTRACT_ITEM_STYLE_COLOR_R_KEY,
+          to_string(static_cast<int>(color->GetRVal())));
+      b.Add(ABSTRACT_ITEM_STYLE_COLOR_G_KEY,
+          to_string(static_cast<int>(color->GetGVal())));
+      b.Add(ABSTRACT_ITEM_STYLE_COLOR_B_KEY,
+          to_string(static_cast<int>(color->GetBVal())));
+    }
+
+    shared_ptr<Geometry> geometry = impl_->style_->GetGeometry();
+    if (geometry.get() != nullptr) {
+      b.Add(ABSTRACT_ITEM_STYLE_GEOMETRY_X_KEY, to_string(geometry->GetX()));
+      b.Add(ABSTRACT_ITEM_STYLE_GEOMETRY_Y_KEY, to_string(geometry->GetY()));
+      b.Add(ABSTRACT_ITEM_STYLE_GEOMETRY_WIDTH_KEY,
+          to_string(geometry->GetWidth()));
+      b.Add(ABSTRACT_ITEM_STYLE_GEOMETRY_HEIGHT_KEY,
+          to_string(geometry->GetHeight()));
+    }
 
+    shared_ptr<Color> bg_color = impl_->style_->GetBackgroundColor();
+    if (bg_color.get() != nullptr) {
+      b.Add(ABSTRACT_ITEM_STYLE_BG_COLOR_A_KEY,
+          to_string(static_cast<int>(bg_color->GetAVal())));
+      b.Add(ABSTRACT_ITEM_STYLE_BG_COLOR_R_KEY,
+          to_string(static_cast<int>(bg_color->GetRVal())));
+      b.Add(ABSTRACT_ITEM_STYLE_BG_COLOR_G_KEY,
+          to_string(static_cast<int>(bg_color->GetGVal())));
+      b.Add(ABSTRACT_ITEM_STYLE_BG_COLOR_B_KEY,
+          to_string(static_cast<int>(bg_color->GetBVal())));
+    }
+    b.Add(ABSTRACT_ITEM_STYLE_BG_IMAGE_PATH_KEY,
+        impl_->style_->GetBackgroundImage());
     b.Add(ABSTRACT_ITEM_STYLE_IS_EXIST_KEY, ABSTRACT_ITEM_TRUE);
   }
 
@@ -204,13 +232,13 @@ Bundle AbstractItem::Serialize() const {
     b.Add(ABSTRACT_ITEM_LED_ON_PERIOD_KEY, to_string(impl_->led_->GetOnPeriod()));
     b.Add(ABSTRACT_ITEM_LED_OFF_PERIOD_KEY, to_string(impl_->led_->GetOffPeriod()));
     b.Add(ABSTRACT_ITEM_LED_COLOR_A_KEY,
-        to_string(static_cast<int>(impl_->led_->GetColor().GetAVal())));
+        to_string(static_cast<int>(impl_->led_->GetColor()->GetAVal())));
     b.Add(ABSTRACT_ITEM_LED_COLOR_R_KEY,
-        to_string(static_cast<int>(impl_->led_->GetColor().GetRVal())));
+        to_string(static_cast<int>(impl_->led_->GetColor()->GetRVal())));
     b.Add(ABSTRACT_ITEM_LED_COLOR_G_KEY,
-        to_string(static_cast<int>(impl_->led_->GetColor().GetGVal())));
+        to_string(static_cast<int>(impl_->led_->GetColor()->GetGVal())));
     b.Add(ABSTRACT_ITEM_LED_COLOR_B_KEY,
-        to_string(static_cast<int>(impl_->led_->GetColor().GetBVal())));
+        to_string(static_cast<int>(impl_->led_->GetColor()->GetBVal())));
     b.Add(ABSTRACT_ITEM_LED_IS_EXIST_KEY, ABSTRACT_ITEM_TRUE);
   }
 
@@ -273,33 +301,66 @@ void AbstractItem::Deserialize(Bundle b) {
   }
 
   if (!b.GetString(ABSTRACT_ITEM_STYLE_IS_EXIST_KEY).compare(ABSTRACT_ITEM_TRUE)) {
-    Padding padding(stoi(b.GetString(ABSTRACT_ITEM_STYLE_PADDING_LEFT_KEY)),
-      stoi(b.GetString(ABSTRACT_ITEM_STYLE_PADDING_TOP_KEY)),
-      stoi(b.GetString(ABSTRACT_ITEM_STYLE_PADDING_RIGHT_KEY)),
-      stoi(b.GetString(ABSTRACT_ITEM_STYLE_PADDING_BOTTOM_KEY)));
-
-    Color color(
-      static_cast<unsigned char>(stoi(b.GetString(ABSTRACT_ITEM_STYLE_COLOR_A_KEY))),
-      static_cast<unsigned char>(stoi(b.GetString(ABSTRACT_ITEM_STYLE_COLOR_R_KEY))),
-      static_cast<unsigned char>(stoi(b.GetString(ABSTRACT_ITEM_STYLE_COLOR_G_KEY))),
-      static_cast<unsigned char>(stoi(b.GetString(ABSTRACT_ITEM_STYLE_COLOR_B_KEY))));
-
-    Geometry geometry(stoi(b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_X_KEY)),
-      stoi(b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_Y_KEY)),
-      stoi(b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_WIDTH_KEY)),
-      stoi(b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_HEIGHT_KEY)));
-
-    impl_->style_ = make_shared<Style>(color, padding, geometry);
+    shared_ptr<Padding> padding;
+    if (!b.GetString(ABSTRACT_ITEM_STYLE_PADDING_LEFT_KEY).empty()) {
+      padding = make_shared<Padding>(
+        stoi(b.GetString(ABSTRACT_ITEM_STYLE_PADDING_LEFT_KEY)),
+        stoi(b.GetString(ABSTRACT_ITEM_STYLE_PADDING_TOP_KEY)),
+        stoi(b.GetString(ABSTRACT_ITEM_STYLE_PADDING_RIGHT_KEY)),
+        stoi(b.GetString(ABSTRACT_ITEM_STYLE_PADDING_BOTTOM_KEY)));
+    }
+
+    shared_ptr<Color> color;
+    if (!b.GetString(ABSTRACT_ITEM_STYLE_COLOR_A_KEY).empty()) {
+      color = make_shared<Color>(
+        static_cast<unsigned char>(
+            stoi(b.GetString(ABSTRACT_ITEM_STYLE_COLOR_A_KEY))),
+        static_cast<unsigned char>(
+            stoi(b.GetString(ABSTRACT_ITEM_STYLE_COLOR_R_KEY))),
+        static_cast<unsigned char>(
+            stoi(b.GetString(ABSTRACT_ITEM_STYLE_COLOR_G_KEY))),
+        static_cast<unsigned char>(
+            stoi(b.GetString(ABSTRACT_ITEM_STYLE_COLOR_B_KEY))));
+    }
+
+    shared_ptr<Geometry> geometry;
+    if (!b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_X_KEY).empty()) {
+      geometry = make_shared<Geometry>(
+        stoi(b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_X_KEY)),
+        stoi(b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_Y_KEY)),
+        stoi(b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_WIDTH_KEY)),
+        stoi(b.GetString(ABSTRACT_ITEM_STYLE_GEOMETRY_HEIGHT_KEY)));
+    }
+
+    shared_ptr<Color> bg_color;
+    if (!b.GetString(ABSTRACT_ITEM_STYLE_BG_COLOR_A_KEY).empty()) {
+      bg_color = make_shared<Color>(
+        static_cast<unsigned char>(
+            stoi(b.GetString(ABSTRACT_ITEM_STYLE_BG_COLOR_A_KEY))),
+        static_cast<unsigned char>(
+            stoi(b.GetString(ABSTRACT_ITEM_STYLE_BG_COLOR_R_KEY))),
+        static_cast<unsigned char>(
+            stoi(b.GetString(ABSTRACT_ITEM_STYLE_BG_COLOR_G_KEY))),
+        static_cast<unsigned char>(
+            stoi(b.GetString(ABSTRACT_ITEM_STYLE_BG_COLOR_B_KEY))));
+    }
+
+    impl_->style_ = make_shared<Style>(color, padding, geometry, bg_color,
+        b.GetString(ABSTRACT_ITEM_STYLE_BG_IMAGE_PATH_KEY));
   }
 
   if (!b.GetString(ABSTRACT_ITEM_LED_IS_EXIST_KEY).compare(ABSTRACT_ITEM_TRUE)) {
-    Color color(
-      static_cast<unsigned char>(stoi(b.GetString(ABSTRACT_ITEM_LED_COLOR_A_KEY))),
-      static_cast<unsigned char>(stoi(b.GetString(ABSTRACT_ITEM_LED_COLOR_R_KEY))),
-      static_cast<unsigned char>(stoi(b.GetString(ABSTRACT_ITEM_LED_COLOR_G_KEY))),
-      static_cast<unsigned char>(stoi(b.GetString(ABSTRACT_ITEM_LED_COLOR_B_KEY))));
-
-    impl_->led_ = make_shared<LEDInfo>(color);
+    shared_ptr<Color> led_color = make_shared<Color>(
+      static_cast<unsigned char>(
+        stoi(b.GetString(ABSTRACT_ITEM_LED_COLOR_A_KEY))),
+      static_cast<unsigned char>(
+        stoi(b.GetString(ABSTRACT_ITEM_LED_COLOR_R_KEY))),
+      static_cast<unsigned char>(
+        stoi(b.GetString(ABSTRACT_ITEM_LED_COLOR_G_KEY))),
+      static_cast<unsigned char>(
+        stoi(b.GetString(ABSTRACT_ITEM_LED_COLOR_B_KEY))));
+
+    impl_->led_ = make_shared<LEDInfo>(led_color);
     impl_->led_->SetOnPeriod(stoi(b.GetString(ABSTRACT_ITEM_LED_ON_PERIOD_KEY)));
     impl_->led_->SetOffPeriod(stoi(b.GetString(ABSTRACT_ITEM_LED_OFF_PERIOD_KEY)));
   }
index e9961a7..ccb9d62 100644 (file)
@@ -67,6 +67,74 @@ class EXPORT_API Color {
   virtual ~Color() = default;
 
   /**
+   * @brief Copy-constructor.
+   * @since_tizen 5.5
+   * @param[in] c The object to copy
+   */
+  Color(const Color& c) {
+    a_ = c.a_;
+    r_ = c.r_;
+    g_ = c.g_;
+    b_ = c.b_;
+  }
+
+  /**
+   * @brief Assignment.
+   * @since_tizen 5.5
+   * @param[in] c The object to copy
+   */
+  Color& operator = (const Color& c) {
+    if (this != &c) {
+      a_ = c.a_;
+      r_ = c.r_;
+      g_ = c.g_;
+      b_ = c.b_;
+    }
+    return *this;
+  }
+
+  /**
+   * @brief Move-constructor.
+   * @since_tizen 5.5
+   * @param[in] c The object to move
+   */
+  Color(Color&& c) noexcept {
+    a_ = c.a_;
+    c.a_ = 0;
+
+    r_ = c.r_;
+    c.r_ = 0;
+
+    g_ = c.g_;
+    c.g_ = 0;
+
+    b_ = c.b_;
+    c.b_ = 0;
+  }
+
+  /**
+   * @brief Assignment.
+   * @since_tizen 5.5
+   * @param[in] c The object to move
+   */
+  Color& operator = (Color&& c) noexcept {
+    if (this != &c) {
+      a_ = c.a_;
+      c.a_ = 0;
+
+      r_ = c.r_;
+      c.r_ = 0;
+
+      g_ = c.g_;
+      c.g_ = 0;
+
+      b_ = c.b_;
+      c.b_ = 0;
+    }
+    return *this;
+  }
+
+  /**
    * @brief Gets alpha value of color.
    * @since_tizen 5.5
    * @return The alpha value of color
@@ -128,6 +196,74 @@ class EXPORT_API Padding {
   virtual ~Padding() = default;
 
   /**
+   * @brief Copy-constructor.
+   * @since_tizen 5.5
+   * @param[in] c The object to copy
+   */
+  Padding(const Padding& c) {
+    left_ = c.left_;
+    top_ = c.top_;
+    right_ = c.right_;
+    bottom_ = c.bottom_;
+  }
+
+  /**
+   * @brief Assignment.
+   * @since_tizen 5.5
+   * @param[in] c The object to copy
+   */
+  Padding& operator = (const Padding& c) {
+    if (this != &c) {
+      left_ = c.left_;
+      top_ = c.top_;
+      right_ = c.right_;
+      bottom_ = c.bottom_;
+    }
+    return *this;
+  }
+
+  /**
+   * @brief Move-constructor.
+   * @since_tizen 5.5
+   * @param[in] c The object to move
+   */
+  Padding(Padding&& c) noexcept {
+    left_ = c.left_;
+    c.left_ = 0;
+
+    top_ = c.top_;
+    c.top_ = 0;
+
+    right_ = c.right_;
+    c.right_ = 0;
+
+    bottom_ = c.bottom_;
+    c.bottom_ = 0;
+  }
+
+  /**
+   * @brief Assignment.
+   * @since_tizen 5.5
+   * @param[in] c The object to move
+   */
+  Padding& operator = (Padding&& c) noexcept {
+    if (this != &c) {
+      left_ = c.left_;
+      c.left_ = 0;
+
+      top_ = c.top_;
+      c.top_ = 0;
+
+      right_ = c.right_;
+      c.right_ = 0;
+
+      bottom_ = c.bottom_;
+      c.bottom_ = 0;
+    }
+    return *this;
+  }
+
+  /**
    * @brief Gets left value of padding.
    * @since_tizen 5.5
    * @return The left value of padding
@@ -188,6 +324,74 @@ class EXPORT_API Geometry {
   virtual ~Geometry() = default;
 
   /**
+   * @brief Copy-constructor.
+   * @since_tizen 5.5
+   * @param[in] c The object to copy
+   */
+  Geometry(const Geometry& c) {
+    x_ = c.x_;
+    y_ = c.y_;
+    w_ = c.w_;
+    h_ = c.h_;
+  }
+
+  /**
+   * @brief Assignment.
+   * @since_tizen 5.5
+   * @param[in] c The object to copy
+   */
+  Geometry& operator = (const Geometry& c) {
+    if (this != &c) {
+      x_ = c.x_;
+      y_ = c.y_;
+      w_ = c.w_;
+      h_ = c.h_;
+    }
+    return *this;
+  }
+
+  /**
+   * @brief Move-constructor.
+   * @since_tizen 5.5
+   * @param[in] c The object to move
+   */
+  Geometry(Geometry&& c) noexcept {
+    x_ = c.x_;
+    c.x_ = 0;
+
+    y_ = c.y_;
+    c.y_ = 0;
+
+    w_ = c.w_;
+    c.w_ = 0;
+
+    h_ = c.h_;
+    c.h_ = 0;
+  }
+
+  /**
+   * @brief Assignment.
+   * @since_tizen 5.5
+   * @param[in] c The object to move
+   */
+  Geometry& operator = (Geometry&& c) noexcept {
+    if (this != &c) {
+      x_ = c.x_;
+      c.x_ = 0;
+
+      y_ = c.y_;
+      c.y_ = 0;
+
+      w_ = c.w_;
+      c.w_ = 0;
+
+      h_ = c.h_;
+      c.h_ = 0;
+    }
+    return *this;
+  }
+
+  /**
    * @brief Gets x value of geometry.
    * @since_tizen 5.5
    * @return The x value of geometry.
@@ -239,42 +443,193 @@ class EXPORT_API Style {
  public:
   Style() {
   }
-  Style(Color color, Padding padding, Geometry geometry)
+
+  Style(std::shared_ptr<Color> color, std::shared_ptr<Padding> padding,
+      std::shared_ptr<Geometry> geometry)
     : color_(color), padding_(padding), geometry_(geometry) {
   }
+
+  Style(std::shared_ptr<Color> color, std::shared_ptr<Padding> padding,
+      std::shared_ptr<Geometry> geometry,
+      std::shared_ptr<Color> background_color, std::string background_image)
+    : color_(color), padding_(padding), geometry_(geometry),
+      background_color_(background_color),
+      background_image_path_(background_image) {
+  }
+
   virtual ~Style() = default;
 
   /**
+   * @brief Copy-constructor.
+   * @since_tizen 5.5
+   * @param[in] c The object to copy
+   */
+  Style(const Style& c) {
+    color_ = c.color_;
+    padding_ = c.padding_;
+    geometry_ = c.geometry_;
+    background_color_ = c.background_color_;
+    background_image_path_ = c.background_image_path_;
+  }
+
+  /**
+   * @brief Assignment.
+   * @since_tizen 5.5
+   * @param[in] c The object to copy
+   */
+  Style& operator = (const Style& c) {
+    if (this != &c) {
+      color_ = c.color_;
+      padding_ = c.padding_;
+      geometry_ = c.geometry_;
+      background_color_ = c.background_color_;
+      background_image_path_ = c.background_image_path_;
+    }
+    return *this;
+  }
+
+  /**
+   * @brief Move-constructor.
+   * @since_tizen 5.5
+   * @param[in] c The object to move
+   */
+  Style(Style&& c) noexcept {
+    color_ = c.color_;
+    c.color_ = nullptr;
+
+    padding_ = c.padding_;
+    c.padding_ = nullptr;
+
+    geometry_ = c.geometry_;
+    c.geometry_ = nullptr;
+
+    background_color_ = c.background_color_;
+    c.background_color_ = nullptr;
+
+    background_image_path_ = c.background_image_path_;
+    c.background_image_path_ = "";
+  }
+
+  /**
+   * @brief Assignment.
+   * @since_tizen 5.5
+   * @param[in] c The object to move
+   */
+  Style& operator = (Style&& c) noexcept {
+    if (this != &c) {
+      color_ = c.color_;
+      c.color_ = nullptr;
+
+      padding_ = c.padding_;
+      c.padding_ = nullptr;
+
+      geometry_ = c.geometry_;
+      c.geometry_ = nullptr;
+
+      background_color_ = c.background_color_;
+      c.background_color_ = nullptr;
+
+      background_image_path_ = c.background_image_path_;
+      c.background_image_path_ = "";
+    }
+    return *this;
+  }
+
+  /**
    * @brief Gets padding data
    * @since_tizen 5.5
    * @return The padding data
    */
-  Padding GetPadding() const {
+  std::shared_ptr<Padding> GetPadding() const {
     return padding_;
   }
 
   /**
+   * @brief Sets padding data
+   * @since_tizen 5.5
+   * @param[in] padding The padding data
+   */
+  void SetPadding(std::shared_ptr<Padding> padding) {
+    padding_ = std::move(padding);
+  }
+
+  /**
    * @brief Gets color data
    * @since_tizen 5.5
    * @return The color data
    */
-  Color GetColor() const {
+  std::shared_ptr<Color> GetColor() const {
     return color_;
   }
 
   /**
+   * @brief Sets color data
+   * @since_tizen 5.5
+   * @param[in] color The color data
+   */
+  void SetColor(std::shared_ptr<Color> color) {
+    color_ = std::move(color);
+  }
+
+  /**
    * @brief Gets geometry data
    * @since_tizen 5.5
    * @return The geometry data
    */
-  Geometry GetGeometry() const {
+  std::shared_ptr<Geometry> GetGeometry() const {
     return geometry_;
   }
 
+  /**
+   * @brief Sets geometry data
+   * @since_tizen 5.5
+   * @param[in] geometry The geometry data
+   */
+  void SetGeometry(std::shared_ptr<Geometry> geometry) {
+    geometry_ = std::move(geometry);
+  }
+
+  /**
+   * @brief Gets background image path
+   * @since_tizen 5.5
+   * @param[in] image_path The background image path
+   */
+  void SetBackgroundImage(std::string image_path) {
+    background_image_path_ = std::move(image_path);
+  }
+
+  /**
+   * @brief Gets background image path
+   * @since_tizen 5.5
+   * @return The background image path
+   */
+  std::string GetBackgroundImage() const {
+    return background_image_path_;
+  }
+
+  /**
+   * @brief Sets background color
+   * @since_tizen 5.5
+   */
+  void SetBackgroundColor(std::shared_ptr<Color> color) {
+    background_color_ = std::move(color);
+  }
+
+  /**
+   * @brief Gets background color
+   * @since_tizen 5.5
+   * @return The background color
+   */
+  std::shared_ptr<Color> GetBackgroundColor() const {
+    return background_color_;
+  }
+
  private:
-  Color color_;
-  Padding padding_;
-  Geometry geometry_;
+  std::shared_ptr<Color> color_;
+  std::shared_ptr<Padding> padding_;
+  std::shared_ptr<Geometry> geometry_;
+  std::shared_ptr<Color> background_color_;
+  std::string background_image_path_;
 };  // class Style
 
 /**
@@ -285,9 +640,8 @@ class EXPORT_API Style {
 class EXPORT_API LEDInfo {
  public:
   LEDInfo() {
-    Color(0, 0, 0, 0);
   }
-  explicit LEDInfo(Color color)
+  explicit LEDInfo(std::shared_ptr<Color> color)
     : color_(color) {
   }
   virtual ~LEDInfo() = default;
@@ -333,12 +687,12 @@ class EXPORT_API LEDInfo {
    * @since_tizen 5.5
    * @return color data
    */
-  Color GetColor() const {
+  std::shared_ptr<Color> GetColor() const {
     return color_;
   }
 
  private:
-  Color color_;
+  std::shared_ptr<Color> color_;
   int on_period_ = 0;
   int off_period_ = 0;
 };  // clss LEDInfo
index b02ab87..86753c5 100644 (file)
@@ -64,6 +64,7 @@ class AbstractItem::Impl {
   time_t time_ = 0;
   uid_t uid_ = 0;
   int request_id_ = 0;
+  std::string background_;
 };
 
 }  // namespace item
index 9e9c05f..50fa8e3 100644 (file)
@@ -963,13 +963,14 @@ extern "C" EXPORT_API int noti_ex_color_create(noti_ex_color_h *handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  auto* p = new (std::nothrow) Color(a, r, g, b);
-  if (p == nullptr) {
+  auto* ptr = new (std::nothrow) shared_ptr<Color>(
+      new (std::nothrow) Color(a, r, g, b));
+  if (ptr == nullptr || ptr->get() == nullptr) {
     LOGE("Out-of-memory");
     return NOTI_EX_ERROR_OUT_OF_MEMORY;
   }
 
-  *handle = p;
+  *handle = ptr;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -980,8 +981,8 @@ extern "C" EXPORT_API int noti_ex_color_destroy(noti_ex_color_h handle) {
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Color* p = static_cast<Color*>(handle);
-  p->~Color();
+  shared_ptr<Color>* p = static_cast<shared_ptr<Color>*>(handle);
+  delete p;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -993,8 +994,8 @@ extern "C" EXPORT_API int noti_ex_color_get_alpha(noti_ex_color_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Color* p = static_cast<Color*>(handle);
-  *val = p->GetAVal();
+  shared_ptr<Color>* p = static_cast<shared_ptr<Color>*>(handle);
+  *val = (*p)->GetAVal();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1006,8 +1007,8 @@ extern "C" EXPORT_API int noti_ex_color_get_red(noti_ex_color_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Color* p = static_cast<Color*>(handle);
-  *val = p->GetRVal();
+  shared_ptr<Color>* p = static_cast<shared_ptr<Color>*>(handle);
+  *val = (*p)->GetRVal();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1019,8 +1020,8 @@ extern "C" EXPORT_API int noti_ex_color_get_green(noti_ex_color_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Color* p = static_cast<Color*>(handle);
-  *val = p->GetGVal();
+  shared_ptr<Color>* p = static_cast<shared_ptr<Color>*>(handle);
+  *val = (*p)->GetGVal();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1032,8 +1033,8 @@ extern "C" EXPORT_API int noti_ex_color_get_blue(noti_ex_color_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Color* p = static_cast<Color*>(handle);
-  *val = p->GetBVal();
+  shared_ptr<Color>* p = static_cast<shared_ptr<Color>*>(handle);
+  *val = (*p)->GetBVal();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1051,7 +1052,14 @@ extern "C" EXPORT_API int noti_ex_padding_create(noti_ex_padding_h *handle,
     return NOTI_EX_ERROR_OUT_OF_MEMORY;
   }
 
-  *handle = p;
+  auto* ptr = new (std::nothrow) shared_ptr<Padding>(
+      new (std::nothrow) Padding(left, top, right, bottom));
+  if (ptr == nullptr || ptr->get() == nullptr) {
+    LOGE("Out-of-memory");
+    return NOTI_EX_ERROR_OUT_OF_MEMORY;
+  }
+
+  *handle = ptr;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1062,8 +1070,8 @@ extern "C" EXPORT_API int noti_ex_padding_destroy(noti_ex_padding_h handle) {
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Padding* p = static_cast<Padding*>(handle);
-  p->~Padding();
+  shared_ptr<Padding>* p = static_cast<shared_ptr<Padding>*>(handle);
+  delete p;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1075,8 +1083,8 @@ extern "C" EXPORT_API int noti_ex_padding_get_left(noti_ex_padding_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Padding* p = static_cast<Padding*>(handle);
-  *val = p->GetLeft();
+  shared_ptr<Padding>* p = static_cast<shared_ptr<Padding>*>(handle);
+  *val = (*p)->GetLeft();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1088,8 +1096,8 @@ extern "C" EXPORT_API int noti_ex_padding_get_top(noti_ex_padding_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Padding* p = static_cast<Padding*>(handle);
-  *val = p->GetTop();
+  shared_ptr<Padding>* p = static_cast<shared_ptr<Padding>*>(handle);
+  *val = (*p)->GetTop();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1101,8 +1109,8 @@ extern "C" EXPORT_API int noti_ex_padding_get_right(noti_ex_padding_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Padding* p = static_cast<Padding*>(handle);
-  *val = p->GetRight();
+  shared_ptr<Padding>* p = static_cast<shared_ptr<Padding>*>(handle);
+  *val = (*p)->GetRight();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1114,8 +1122,8 @@ extern "C" EXPORT_API int noti_ex_padding_get_bottom(noti_ex_padding_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Padding* p = static_cast<Padding*>(handle);
-  *val = p->GetBottom();
+  shared_ptr<Padding>* p = static_cast<shared_ptr<Padding>*>(handle);
+  *val = (*p)->GetBottom();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1127,13 +1135,14 @@ extern "C" EXPORT_API int noti_ex_geometry_create(noti_ex_geometry_h *handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  auto* p = new (std::nothrow) Geometry(x, y, w, h);
-  if (p == nullptr) {
+  auto* ptr = new (std::nothrow) shared_ptr<Geometry>(
+      new (std::nothrow) Geometry(x, y, w, h));
+  if (ptr == nullptr || ptr->get() == nullptr) {
     LOGE("Out-of-memory");
     return NOTI_EX_ERROR_OUT_OF_MEMORY;
   }
 
-  *handle = p;
+  *handle = ptr;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1144,8 +1153,8 @@ extern "C" EXPORT_API int noti_ex_geometry_destroy(noti_ex_geometry_h handle) {
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Geometry* p = static_cast<Geometry*>(handle);
-  p->~Geometry();
+  shared_ptr<Geometry>* p = static_cast<shared_ptr<Geometry>*>(handle);
+  delete p;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1157,8 +1166,8 @@ extern "C" EXPORT_API int noti_ex_geometry_get_x(noti_ex_geometry_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Geometry* p = static_cast<Geometry*>(handle);
-  *val = p->GetX();
+  shared_ptr<Geometry>* p = static_cast<shared_ptr<Geometry>*>(handle);
+  *val = (*p)->GetX();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1170,8 +1179,8 @@ extern "C" EXPORT_API int noti_ex_geometry_get_y(noti_ex_geometry_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Geometry* p = static_cast<Geometry*>(handle);
-  *val = p->GetY();
+  shared_ptr<Geometry>* p = static_cast<shared_ptr<Geometry>*>(handle);
+  *val = (*p)->GetY();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1183,8 +1192,8 @@ extern "C" EXPORT_API int noti_ex_geometry_get_width(noti_ex_geometry_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Geometry* p = static_cast<Geometry*>(handle);
-  *val = p->GetWidth();
+  shared_ptr<Geometry>* p = static_cast<shared_ptr<Geometry>*>(handle);
+  *val = (*p)->GetWidth();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1196,8 +1205,8 @@ extern "C" EXPORT_API int noti_ex_geometry_get_height(noti_ex_geometry_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Geometry* p = static_cast<Geometry*>(handle);
-  *val = p->GetHeight();
+  shared_ptr<Geometry>* p = static_cast<shared_ptr<Geometry>*>(handle);
+  *val = (*p)->GetHeight();
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1211,17 +1220,21 @@ extern "C" EXPORT_API int noti_ex_style_create(noti_ex_style_h *handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Color* color_ = static_cast<Color*>(color);
-  Padding* padding_ = static_cast<Padding*>(padding);
-  Geometry* geo_ = static_cast<Geometry*>(geometry);
+  shared_ptr<Color> col = (color == nullptr) ?
+      nullptr : *(static_cast<shared_ptr<Color>*>(color));
+  shared_ptr<Padding> padd = (padding == nullptr) ?
+      nullptr : *(static_cast<shared_ptr<Padding>*>(padding));
+  shared_ptr<Geometry> geo = (geometry == nullptr) ?
+      nullptr : *(static_cast<shared_ptr<Geometry>*>(geometry));
 
-  auto* p = new (std::nothrow) Style(*color_, *padding_, *geo_);
-  if (p == nullptr) {
+  auto* ptr = new (std::nothrow) shared_ptr<Style>(
+      new (std::nothrow) Style(col, padd, geo));
+  if (ptr == nullptr || ptr->get() == nullptr) {
     LOGE("Out-of-memory");
     return NOTI_EX_ERROR_OUT_OF_MEMORY;
   }
 
-  *handle = p;
+  *handle = ptr;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1232,8 +1245,8 @@ extern "C" EXPORT_API int noti_ex_style_destroy(noti_ex_style_h handle) {
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Style* p = static_cast<Style*>(handle);
-  p->~Style();
+  shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle);
+  delete p;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1245,14 +1258,20 @@ extern "C" EXPORT_API int noti_ex_style_get_padding(noti_ex_style_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Style* p = static_cast<Style*>(handle);
-  Padding* padding_ = new (std::nothrow) Padding(p->GetPadding());
-  if (padding_ == nullptr) {
+  shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle);
+  if ((*p)->GetPadding() == nullptr) {
+    LOGW("Padding info is null");
+    return NOTI_EX_ERROR_INVALID_PARAMETER;
+  }
+
+  shared_ptr<Padding>* padd = new (std::nothrow) shared_ptr<Padding>(
+      new (std::nothrow) Padding(*((*p)->GetPadding())));
+  if (padd == nullptr || padd->get() == nullptr) {
     LOGE("Out-of-memory");
     return NOTI_EX_ERROR_OUT_OF_MEMORY;
   }
 
-  *padding = padding_;
+  *padding = padd;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1264,14 +1283,20 @@ extern "C" EXPORT_API int noti_ex_style_get_color(noti_ex_style_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Style* p = static_cast<Style*>(handle);
-  Color* color_ = new (std::nothrow) Color(p->GetColor());
-  if (color_ == nullptr) {
+  shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle);
+  if ((*p)->GetColor() == nullptr) {
+    LOGW("Color info is null");
+    return NOTI_EX_ERROR_INVALID_PARAMETER;
+  }
+
+  shared_ptr<Color>* col = new (std::nothrow) shared_ptr<Color>(
+      new (std::nothrow) Color(*((*p)->GetColor())));
+  if (col == nullptr || col->get() == nullptr) {
     LOGE("Out-of-memory");
     return NOTI_EX_ERROR_OUT_OF_MEMORY;
   }
 
-  *color = color_;
+  *color = col;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1283,14 +1308,20 @@ extern "C" EXPORT_API int noti_ex_style_get_geometry(noti_ex_style_h handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Style* p = static_cast<Style*>(handle);
-  Geometry* geo_ = new (std::nothrow) Geometry(p->GetGeometry());
-  if (geo_ == nullptr) {
+  shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle);
+  if ((*p)->GetGeometry() == nullptr) {
+    LOGW("Geometry info is null");
+    return NOTI_EX_ERROR_INVALID_PARAMETER;
+  }
+
+  shared_ptr<Geometry>* geo = new (std::nothrow) shared_ptr<Geometry>(
+      new (std::nothrow) Geometry(*((*p)->GetGeometry())));
+  if (geo == nullptr || geo->get() == nullptr) {
     LOGE("Out-of-memory");
     return NOTI_EX_ERROR_OUT_OF_MEMORY;
   }
 
-  *geometry = geo_;
+  *geometry = geo;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1302,7 +1333,7 @@ extern "C" EXPORT_API int noti_ex_led_info_create(noti_ex_led_info_h *handle,
     return NOTI_EX_ERROR_INVALID_PARAMETER;
   }
 
-  Color* color_ = static_cast<Color*>(color);
+  shared_ptr<Color>* color_ = static_cast<shared_ptr<Color>*>(color);
   auto* p = new (std::nothrow) LEDInfo(*color_);
   if (p == nullptr) {
     LOGE("Out-of-memory");
@@ -1386,13 +1417,19 @@ extern "C" EXPORT_API int noti_ex_led_info_get_color(
   }
 
   LEDInfo* p = static_cast<LEDInfo*>(handle);
-  Color* color_ = new (std::nothrow) Color(p->GetColor());
-  if (color_ == nullptr) {
+  if (p->GetColor() == nullptr) {
+    LOGE("Color is null");
+    return NOTI_EX_ERROR_INVALID_PARAMETER;
+  }
+
+  shared_ptr<Color>* col = new (std::nothrow) shared_ptr<Color>(
+      new (std::nothrow) Color(*(p->GetColor())));
+  if (col == nullptr || col->get() == nullptr) {
     LOGE("Out-of-memory");
     return NOTI_EX_ERROR_OUT_OF_MEMORY;
   }
 
-  *color = color_;
+  *color = col;
 
   return NOTI_EX_ERROR_NONE;
 }
@@ -1638,7 +1675,18 @@ extern "C" EXPORT_API int noti_ex_item_get_style(noti_ex_item_h handle,
 
   Handle* p = static_cast<Handle*>(handle);
   shared_ptr<Style> s = p->Get()->GetStyle();
-  *style = static_cast<noti_ex_style_h>(s.get());
+  if (s.get() == nullptr) {
+    LOGE("Style is null");
+    return NOTI_EX_ERROR_INVALID_PARAMETER;
+  }
+
+  auto* ptr = new (std::nothrow) shared_ptr<Style>(new (std::nothrow) Style(*s));
+  if (ptr == nullptr || ptr->get() == nullptr) {
+    LOGE("Out of memory");
+    return NOTI_EX_ERROR_OUT_OF_MEMORY;
+  }
+
+  *style = ptr;
   return NOTI_EX_ERROR_NONE;
 }
 
@@ -1650,8 +1698,8 @@ extern "C" EXPORT_API int noti_ex_item_set_style(noti_ex_item_h handle,
   }
 
   Handle* p = static_cast<Handle*>(handle);
-  Style* s = static_cast<Style*>(style);
-  p->Get()->SetStyle(shared_ptr<Style>(s));
+  shared_ptr<Style>* s = static_cast<shared_ptr<Style>*>(style);
+  p->Get()->SetStyle(*s);
   return NOTI_EX_ERROR_NONE;
 }
 
index 0a7ed6f..784b8df 100644 (file)
@@ -98,11 +98,12 @@ TEST_F(AbstractItemTest, SerializeDeserialize) {
 
   TestItem item("test_id", action);
 
-  Color color(50, 100,150,200);
-  Padding padding(10, 20, 30, 40);
-  Geometry geometry(110, 120, 130, 140);
+  std::shared_ptr<Color> color = std::make_shared<Color>(50, 100,150,200);
+  std::shared_ptr<Padding> padding = std::make_shared<Padding>(10, 20, 30, 40);
+  std::shared_ptr<Geometry> geometry = std::make_shared<Geometry>(110, 120, 130, 140);
+  std::shared_ptr<Color> bg_color = std::make_shared<Color>(71, 72, 73, 74);
 
-  item.SetStyle(std::make_shared<Style>(color, padding, geometry));
+  item.SetStyle(std::make_shared<Style>(color, padding, geometry, bg_color, "bg path"));
   item.SetVisible(false);
   item.SetEnable(false);
   item.AddReceiver("receiver_1");
@@ -123,8 +124,7 @@ TEST_F(AbstractItemTest, SerializeDeserialize) {
   time(&current_time);
   std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetTime(current_time);
 
-  Color color2(150, 160, 170, 180);
-
+  std::shared_ptr<Color> color2 = std::make_shared<Color>(150, 160, 170, 180);
   std::shared_ptr<LEDInfo> led = std::make_shared<LEDInfo>(color2);
   led->SetOnPeriod(10);
   led->SetOffPeriod(20);
@@ -153,25 +153,32 @@ TEST_F(AbstractItemTest, SerializeDeserialize) {
   ASSERT_EQ(gen_test->GetTag(), "tag");
   ASSERT_EQ(gen_test->GetInfo()->GetTime(), current_time);
 
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding().GetLeft(), 10);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding().GetTop(), 20);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding().GetRight(), 30);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding().GetBottom(), 40);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetColor().GetAVal(), 50);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor().GetRVal(), 100);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor().GetGVal(), 150);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor().GetBVal(), 200);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry().GetX(), 110);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry().GetY(), 120);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry().GetWidth(), 130);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry().GetHeight(), 140);
-
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor().GetAVal(), 150);
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor().GetRVal(), 160);
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor().GetGVal(), 170);
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor().GetBVal(), 180);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetLeft(), 10);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetTop(), 20);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetRight(), 30);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetBottom(), 40);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetAVal(), 50);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetRVal(), 100);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetGVal(), 150);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetBVal(), 200);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetX(), 110);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetY(), 120);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetWidth(), 130);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetHeight(), 140);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetAVal(), 71);
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetRVal(), 72);
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetGVal(), 73);
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetBVal(), 74);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundImage(), "bg path");
+
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetAVal(), 150);
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetRVal(), 160);
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetGVal(), 170);
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetBVal(), 180);
   ASSERT_EQ(gen_test->GetLEDInfo()->GetOnPeriod(), 10);
   ASSERT_EQ(gen_test->GetLEDInfo()->GetOffPeriod(), 20);
 
@@ -219,6 +226,41 @@ TEST_F(AbstractItemTest, SerializeDeserialize) {
   ASSERT_STREQ(app_id, "new_appid_1");
 }
 
+TEST_F(AbstractItemTest, SerializeDeserialize2) {
+  /* Serialize */
+  TestItem item("test_id");
+
+  std::shared_ptr<Color> color = std::make_shared<Color>(50, 100,150,200);
+  std::shared_ptr<Padding> padding = std::make_shared<Padding>(10, 20, 30, 40);
+  std::shared_ptr<Geometry> geometry = std::make_shared<Geometry>(110, 120, 130, 140);
+
+  item.SetStyle(std::make_shared<Style>(color, padding, geometry, nullptr, ""));
+
+  /* Deserialize */
+  Bundle b = item.Serialize();
+
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  TestItem* gen_test = static_cast<TestItem*>(gen_item.get());
+
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetLeft(), 10);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetTop(), 20);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetRight(), 30);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetBottom(), 40);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetAVal(), 50);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetRVal(), 100);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetGVal(), 150);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetBVal(), 200);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetX(), 110);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetY(), 120);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetWidth(), 130);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetHeight(), 140);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor(), nullptr);
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundImage(), "");
+}
+
 TEST_F(AbstractItemTest, ItemInfoCanReceive) {
   TestItem item("test_id");