#include "notification-ex/abstract_item_implementation.h"
#include "notification-ex/item_info_internal.h"
#include "notification-ex/ex_util.h"
+#include "notification-ex/action_inflator.h"
#ifdef LOG_TAG
#undef LOG_TAG
#define LOG_TAG "NOTIFICATION_EX"
#define ABSTRACT_ITEM_TYPE_KEY "__ABSTRACT_ITEM_TYPE_KEY__"
#define ABSTRACT_ITEM_ID_KEY "__ABSTRACT_ITEM_ID_KEY__"
+#define ABSTRACT_ITEM_UID_KEY "__ABSTRACT_ITEM_UID_KEY__"
+#define ABSTRACT_ITEM_REQUEST_ID_KEY "__ABSTRACT_ITEM_REQUEST_ID_KEY__"
+#define ABSTRACT_ITEM_TIME_KEY "__ABSTRACT_ITEM_TIME_KEY__"
#define ABSTRACT_ITEM_SENDER_APPID_KEY "__ABSTRACT_ITEM_SENDER_APPID_KEY__"
+#define ABSTRACT_ITEM_CHANNEL_KEY "__ABSTRACT_ITEM_CHANNEL_KEY__"
+#define ABSTRACT_ITEM_VERSION_KEY "__ABSTRACT_ITEM_VERSION_KEY__"
+#define ABSTRACT_ITEM_HIDE_TIME_KEY "__ABSTRACT_ITEM_HIDE_TIME_KEY__"
+#define ABSTRACT_ITEM_DELETE_TIME_KEY "__ABSTRACT_ITEM_DELETE_TIME_KEY__"
+#define ABSTRACT_ITEM_CAN_RECEIVE_KEY "__ABSTRACT_ITEM_CAN_RECEIVE_KEY__"
+#define ABSTRACT_ITEM_SOUND_PATH_KEY "__ABSTRACT_ITEM_SOUND_PATH_KEY__"
+#define ABSTRACT_ITEM_VIBRATION_PATH_KEY "__ABSTRACT_ITEM_VIBRATION_PATH_KEY__"
+#define ABSTRACT_ITEM_POLICY_KEY "__ABSTRACT_ITEM_POLICY_KEY__"
+#define ABSTRACT_ITEM_RECEIVER_GROUP_KEY "__ABSTRACT_ITEM_RECEIVER_GROUP_KEY__"
+#define ABSTRACT_ITEM_VISIBLE_KEY "__ABSTRACT_ITEM_VISIBLE_KEY__"
+#define ABSTRACT_ITEM_ENABLE_KEY "__ABSTRACT_ITEM_ENABLE_KEY__"
+#define ABSTRACT_ITEM_STYLE_IS_EXIST_KEY "__ABSTRACT_ITEM_STYLE_IS_EXIST_KEY__"
+#define ABSTRACT_ITEM_STYLE_PADDING_TOP_KEY "__ABSTRACT_ITEM_STYLE_PADDING_TOP_KEY__"
+#define ABSTRACT_ITEM_STYLE_PADDING_LEFT_KEY "__ABSTRACT_ITEM_STYLE_PADDING_LEFT_KEY__"
+#define ABSTRACT_ITEM_STYLE_PADDING_RIGHT_KEY "__ABSTRACT_ITEM_STYLE_PADDING_RIGHT_KEY__"
+#define ABSTRACT_ITEM_STYLE_PADDING_BOTTOM_KEY "__ABSTRACT_ITEM_STYLE_PADDING_BOTTOM_KEY__"
+#define ABSTRACT_ITEM_STYLE_COLOR_A_KEY "__ABSTRACT_ITEM_STYLE_COLOR_A_KEY__"
+#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_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__"
+#define ABSTRACT_ITEM_STYLE_GEOMETRY_HEIGHT_KEY "__ABSTRACT_ITEM_STYLE_GEOMETRY_HEIGHT_KEY__"
+#define ABSTRACT_ITEM_LED_ON_PERIOD_KEY "__ABSTRACT_ITEM_LED_ON_PERIOD_KEY__"
+#define ABSTRACT_ITEM_LED_OFF_PERIOD_KEY "__ABSTRACT_ITEM_LED_OFF_PERIOD_KEY__"
+#define ABSTRACT_ITEM_LED_COLOR_A_KEY "__ABSTRACT_ITEM_LED_COLOR_A_KEY__"
+#define ABSTRACT_ITEM_LED_COLOR_R_KEY "__ABSTRACT_ITEM_LED_COLOR_R_KEY__"
+#define ABSTRACT_ITEM_LED_COLOR_G_KEY "__ABSTRACT_ITEM_LED_COLOR_G_KEY__"
+#define ABSTRACT_ITEM_LED_COLOR_B_KEY "__ABSTRACT_ITEM_LED_COLOR_B_KEY__"
+#define ABSTRACT_ITEM_LED_IS_EXIST_KEY "__ABSTRACT_ITEM_LED_IS_EXIST_KEY__"
+#define ABSTRACT_ITEM_ACTION_KEY "__ABSTRACT_ITEM_ACTION_KEY__"
+#define ABSTRACT_ITEM_TRUE "TRUE"
using namespace std;
namespace notification {
Bundle AbstractItem::Serialize() const {
Bundle b;
- b.Add(ABSTRACT_ITEM_TYPE_KEY, to_string(GetType()));
+ struct tm* timeinfo;
+ char buf[80] = {0,};
+
+ if (!impl_->channel_.empty())
+ b.Add(ABSTRACT_ITEM_CHANNEL_KEY, impl_->channel_);
+
b.Add(ABSTRACT_ITEM_ID_KEY, impl_->id_);
b.Add(ABSTRACT_ITEM_SENDER_APPID_KEY, GetSenderAppId().c_str());
+ b.Add(ABSTRACT_ITEM_TYPE_KEY, to_string(GetType()));
+ b.Add(ABSTRACT_ITEM_VERSION_KEY, to_string(impl_->version_));
+ b.Add(ABSTRACT_ITEM_HIDE_TIME_KEY, to_string(impl_->hide_time_));
+ b.Add(ABSTRACT_ITEM_DELETE_TIME_KEY, to_string(impl_->delete_time_));
+ b.Add(ABSTRACT_ITEM_UID_KEY, to_string(impl_->uid_));
+ b.Add(ABSTRACT_ITEM_REQUEST_ID_KEY, to_string(impl_->request_id_));
+
+ timeinfo = localtime(&impl_->time_);
+ strftime (buf, sizeof(buf), "%s", timeinfo);
+ b.Add(ABSTRACT_ITEM_TIME_KEY, string(buf));
+
+ if (!impl_->can_receive_.empty())
+ b.Add(ABSTRACT_ITEM_CAN_RECEIVE_KEY, impl_->can_receive_);
+
+ if (!impl_->sound_path_.empty())
+ b.Add(ABSTRACT_ITEM_SOUND_PATH_KEY, impl_->sound_path_);
+
+ if (!impl_->vibration_path_.empty())
+ b.Add(ABSTRACT_ITEM_VIBRATION_PATH_KEY, impl_->vibration_path_);
+
+ b.Add(ABSTRACT_ITEM_VISIBLE_KEY, to_string((int)impl_->visible_));
+
+ b.Add(ABSTRACT_ITEM_ENABLE_KEY, to_string((int)impl_->enable_));
+
+ b.Add(ABSTRACT_ITEM_POLICY_KEY, to_string((int)impl_->policy_));
+
+ if (impl_->receiver_group_list_.size() != 0) {
+ vector<string> arr;
+
+ for (auto& i : impl_->receiver_group_list_) {
+ string receiver = i;
+
+ arr.push_back(receiver);
+ }
+ b.Add(ABSTRACT_ITEM_RECEIVER_GROUP_KEY, arr);
+ }
+
+ 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()));
+
+ b.Add(ABSTRACT_ITEM_STYLE_IS_EXIST_KEY, ABSTRACT_ITEM_TRUE);
+ }
+
+ if (impl_->led_ != nullptr) {
+ 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())));
+ b.Add(ABSTRACT_ITEM_LED_COLOR_R_KEY,
+ 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())));
+ b.Add(ABSTRACT_ITEM_LED_COLOR_B_KEY,
+ to_string(static_cast<int>(impl_->led_->GetColor().GetBVal())));
+ b.Add(ABSTRACT_ITEM_LED_IS_EXIST_KEY, ABSTRACT_ITEM_TRUE);
+ }
+
+ if (impl_->action_ != nullptr) {
+ b.Add(ABSTRACT_ITEM_ACTION_KEY,
+ reinterpret_cast<char*>(impl_->action_->Serialize().ToRaw().first.get()));
+ }
+
return b;
}
void AbstractItem::Deserialize(Bundle b) {
+ string time_s;
+ struct tm timeinfo;
+
string type_str = b.GetString(ABSTRACT_ITEM_TYPE_KEY);
if (type_str.empty())
THROW(NOTIFICATION_ERROR_IO_ERROR);
- string id_str = b.GetString(ABSTRACT_ITEM_ID_KEY);
- impl_->id_ = id_str;
+ impl_->id_ = b.GetString(ABSTRACT_ITEM_ID_KEY);
impl_->sender_appid_ = b.GetString(ABSTRACT_ITEM_SENDER_APPID_KEY);
+ impl_->channel_ = b.GetString(ABSTRACT_ITEM_CHANNEL_KEY);
+ impl_->version_ = stoi(b.GetString(ABSTRACT_ITEM_VERSION_KEY));
+ impl_->hide_time_ = stoi(b.GetString(ABSTRACT_ITEM_HIDE_TIME_KEY));
+ impl_->delete_time_ = stoi(b.GetString(ABSTRACT_ITEM_DELETE_TIME_KEY));
+ impl_->can_receive_ = b.GetString(ABSTRACT_ITEM_CAN_RECEIVE_KEY);
+ impl_->sound_path_ = b.GetString(ABSTRACT_ITEM_SOUND_PATH_KEY);
+ impl_->vibration_path_ = b.GetString(ABSTRACT_ITEM_VIBRATION_PATH_KEY);
+ impl_->uid_ = stoi(b.GetString(ABSTRACT_ITEM_UID_KEY));
+ impl_->request_id_ = stoi(b.GetString(ABSTRACT_ITEM_REQUEST_ID_KEY));
+
+ time_s = b.GetString(ABSTRACT_ITEM_TIME_KEY);
+ strptime(time_s.c_str(), "%s", &timeinfo);
+ impl_->time_ = mktime(&timeinfo);
+
+ string policy_str = b.GetString(ABSTRACT_ITEM_POLICY_KEY);
+
+ impl_->policy_ = static_cast<Policy>(stoi(policy_str));
+
+ impl_->visible_ = (bool)stoi(b.GetString(ABSTRACT_ITEM_VISIBLE_KEY));
+
+ impl_->enable_ = (bool)stoi(b.GetString(ABSTRACT_ITEM_ENABLE_KEY));
+
+ vector<string> str_arr = b.GetStringArray(ABSTRACT_ITEM_RECEIVER_GROUP_KEY);
+
+ if (str_arr.size() != 0) {
+ for (string str : str_arr) {
+ impl_->receiver_group_list_.push_back(str);
+ }
+ }
+
+ 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);
+ }
+
+ 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);
+ impl_->led_->SetOnPeriod(stoi(b.GetString(ABSTRACT_ITEM_LED_ON_PERIOD_KEY)));
+ impl_->led_->SetOffPeriod(stoi(b.GetString(ABSTRACT_ITEM_LED_OFF_PERIOD_KEY)));
+ }
+
+ string action_str = b.GetString(ABSTRACT_ITEM_ACTION_KEY);
+
+ if (!action_str.empty())
+ impl_->action_ = ActionInflator::Create(Bundle(action_str));
}
string AbstractItem::GetId() const {
impl_->visible_ = visible;
}
+bool AbstractItem::GetVisible() const {
+ return impl_->visible_;
+}
+
void AbstractItem::SetEnable(bool enable) {
impl_->enable_ = enable;
}
+bool AbstractItem::GetEnable() const {
+ return impl_->enable_;
+}
+
void AbstractItem::AddReceiver(std::string receiver_group) {
impl_->receiver_group_list_.push_back(receiver_group);
}
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <app_control.h>
+
+#include "notification-ex/item_inflator.h"
+#include "notification-ex/app_control_action.h"
+#include "notification-ex/item_info_internal.h"
+#include "notification-ex/iitem_factory.h"
+#include "notification-ex/factory_manager.h"
+#include "notification-ex/default_item_factory.h"
+
+#define MY_ITEM_TYPE AbstractItem::Type::Custom + 1
+
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class TestItem : public AbstractItem {
+ public:
+ TestItem(std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}))
+ : AbstractItem(action) {
+ }
+ TestItem(std::string id, std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}))
+ : AbstractItem(id, action) {
+ }
+ virtual ~TestItem() {}
+
+ Bundle Serialize() const override {
+ Bundle b;
+ b = AbstractItem::Serialize();
+ return b;
+ }
+ void Deserialize(Bundle b) override {
+ AbstractItem::Deserialize(b);
+ }
+ AbstractItem& FindByID(std::string id) override {
+ return *this;
+ }
+ int GetType() const override {
+ return MY_ITEM_TYPE;
+ }
+};
+
+class MyFactory : public IItemFactory {
+ public:
+ MyFactory() {}
+ virtual ~MyFactory() {}
+
+ std::unique_ptr<AbstractItem> CreateItem(int type) override {
+ if (type == MY_ITEM_TYPE)
+ return std::unique_ptr<AbstractItem>(new TestItem(""));
+
+ return nullptr;
+ }
+};
+
+class AbstractItemTest : public ::testing::Test {
+ public:
+ virtual void SetUp() {
+ FactoryManager::GetInst().RegisterFactory(std::unique_ptr<IItemFactory>(new MyFactory()));
+ }
+ virtual void TearDown() {
+ FactoryManager::GetInst().RegisterFactory(std::unique_ptr<IItemFactory>(new DefaultItemFactory()));
+ }
+};
+
+TEST_F(AbstractItemTest, SerializeDeserialize) {
+ /* Serialize */
+ app_control_h app_control;
+ char* app_id = NULL;
+
+ app_control_create(&app_control);
+ app_control_set_app_id(app_control, "new_appid");
+ std::shared_ptr<AppControlAction> action = std::make_shared<AppControlAction>(app_control);
+ app_control_destroy(app_control);
+
+ TestItem item("test_id", action);
+
+ Color color(50, 100,150,200);
+ Padding padding(10, 20, 30, 40);
+ Geometry geometry(110, 120, 130, 140);
+
+ item.SetStyle(std::make_shared<Style>(color, padding, geometry));
+ item.SetVisible(false);
+ item.SetEnable(false);
+ item.AddReceiver("receiver_1");
+ item.AddReceiver("receiver_2");
+ item.SetPolicy(AbstractItem::Policy::OnBootClear);
+ item.GetInfo()->SetVersion(3);
+ std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetHideTime(5);
+ std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetDeleteTime(9);
+ item.SetChannel("channel99");
+ item.SetSoundPath("soundpath");
+ item.SetVibrationPath("vibrationpath");
+ item.SetUid(3);
+ item.SetSenderAppId("sender");
+
+ Color color2(150, 160, 170, 180);
+
+ std::shared_ptr<LEDInfo> led = std::make_shared<LEDInfo>(color2);
+ led->SetOnPeriod(10);
+ led->SetOffPeriod(20);
+
+ item.SetLEDInfo(led);
+
+ /* 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->GetId(), "test_id");
+ ASSERT_EQ(gen_test->GetType(), MY_ITEM_TYPE);
+ ASSERT_EQ(gen_test->GetUid(), 3);
+ ASSERT_EQ(gen_test->GetRequestId(), 0);
+ ASSERT_EQ(gen_test->GetEnable(), false);
+ ASSERT_EQ(gen_test->GetVisible(),false);
+ ASSERT_EQ(gen_test->GetPolicy(), AbstractItem::Policy::OnBootClear);
+ ASSERT_EQ(gen_test->GetInfo()->GetVersion(), 3);
+ ASSERT_EQ(std::static_pointer_cast<IItemInfoInternal>(gen_test->GetInfo())->GetHideTime(), 5);
+ ASSERT_EQ(std::static_pointer_cast<IItemInfoInternal>(gen_test->GetInfo())->GetDeleteTime(), 9);
+ ASSERT_EQ(gen_test->GetChannel(), "channel99");
+ ASSERT_EQ(gen_test->GetSoundPath(), "soundpath");
+ ASSERT_EQ(gen_test->GetVibrationPath(), "vibrationpath");
+ ASSERT_EQ(gen_test->GetSenderAppId(), "sender");
+ ASSERT_EQ(gen_test->GetTime(), 0);
+
+ 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->GetLEDInfo()->GetOnPeriod(), 10);
+ ASSERT_EQ(gen_test->GetLEDInfo()->GetOffPeriod(), 20);
+
+ std::list<std::string> receiver1 = item.GetReceiverList();
+ std::list<std::string> receiver2 = gen_test->GetReceiverList();
+
+ ASSERT_EQ(receiver1.size(), receiver2.size());
+
+ for (unsigned int i = 0; i < receiver1.size(); i++) {
+ ASSERT_EQ(receiver1.front(), receiver2.front());
+ receiver1.pop_front();
+ receiver2.pop_front();
+ }
+
+ ASSERT_EQ(gen_test->GetAction()->GetType(), AbstractAction::Type::AppControl);
+
+ std::shared_ptr<AppControlAction> ac =
+ std::static_pointer_cast<AppControlAction>(gen_test->GetAction());
+ app_control_get_app_id(ac->GetAppControl(), &app_id);
+
+ ASSERT_STREQ(app_id, "new_appid");
+}
+
+} // namespace
\ No newline at end of file