From: mk5004.lee Date: Thu, 25 Jun 2020 02:46:34 +0000 (+0900) Subject: Delete icon_text_item X-Git-Tag: submit/tizen/20200710.064112~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F237092%2F1;p=platform%2Fcore%2Fapi%2Fnotification.git Delete icon_text_item - Not currently in use Change-Id: Id16411b39cb12f9ab073dccbf142539660a882e6 Signed-off-by: mk5004.lee --- diff --git a/notification-ex/default_item_factory.cc b/notification-ex/default_item_factory.cc index 31917f80..e6741d50 100644 --- a/notification-ex/default_item_factory.cc +++ b/notification-ex/default_item_factory.cc @@ -27,7 +27,6 @@ #include "notification-ex/input_selector_item.h" #include "notification-ex/progress_item.h" #include "notification-ex/icon_item.h" -#include "notification-ex/icon_text_item.h" #include "notification-ex/image_item.h" #include "notification-ex/checkbox_item.h" #include "notification-ex/chat_message_item.h" @@ -60,8 +59,6 @@ unique_ptr DefaultItemFactory::CreateItem(int type) { nullptr, nullptr, nullptr, nullptr, ChatMessageItem::Type::user)); case AbstractItem::CheckBox : return unique_ptr(new CheckBoxItem("", "")); - case AbstractItem::IconText : - return unique_ptr(new IconTextItem("", nullptr, nullptr)); case AbstractItem::InputSelector : return unique_ptr(new InputSelectorItem()); case AbstractItem::Group : diff --git a/notification-ex/icon_text_item.cc b/notification-ex/icon_text_item.cc deleted file mode 100644 index d6a521b7..00000000 --- a/notification-ex/icon_text_item.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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 - -#include "notification-ex/icon_text_item.h" -#include "notification-ex/icon_text_item_implementation.h" -#include "notification-ex/factory_manager.h" -#include "notification-ex/exception.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "NOTIFICATION_EX" -#define ICONTEXT_PATH_KEY "__ICONTEXT_PATH_KEY__" -#define ICONTEXT_TITLE_KEY "__ICONTEXT_TITLE_KEY__" - -using namespace tizen_base; - -namespace notification { -namespace item { - -IconTextItem::IconTextItem(std::string id, std::shared_ptr icon, - std::shared_ptr text, std::shared_ptr action) - : AbstractItem(id, action), impl_(new Impl(this, icon, text)) { -} - -IconTextItem::Impl::Impl(IconTextItem* parent, std::shared_ptr icon, - std::shared_ptr text) - : parent_(parent), icon_(icon), text_(text) { - LOGI("IconTextItem impl created"); -} - -int IconTextItem::GetType() const { - return AbstractItem::IconText; -} - -Bundle IconTextItem::Serialize() const { - Bundle b; - b = AbstractItem::Serialize(); - - b.Add(ICONTEXT_PATH_KEY, - reinterpret_cast(impl_->icon_->Serialize().ToRaw().first.get())); - b.Add(ICONTEXT_TITLE_KEY, - reinterpret_cast(impl_->text_->Serialize().ToRaw().first.get())); - return b; -} - -void IconTextItem::Deserialize(Bundle b) { - AbstractItem::Deserialize(b); - - std::shared_ptr icon = - FactoryManager::GetInst().CreateItem(AbstractItem::Icon); - icon.get()->Deserialize(Bundle(b.GetString(ICONTEXT_PATH_KEY))); - impl_->icon_ = std::static_pointer_cast(icon); - - std::shared_ptr text = - FactoryManager::GetInst().CreateItem(AbstractItem::Text); - text.get()->Deserialize(Bundle(b.GetString(ICONTEXT_TITLE_KEY))); - impl_->text_ = std::static_pointer_cast(text); -} - -AbstractItem& IconTextItem::FindByID(std::string id) { - if (GetId() == id) - return *this; - - if (impl_->icon_->GetId() == id) - return *(impl_->icon_); - - if (impl_->text_->GetId() == id) - return *(impl_->text_); - - return FactoryManager::GetInst().GetNullItem(); -} - -AbstractItem& IconTextItem::FindByMainType(MainType type) { - if (GetMainType() == type) - return *this; - - if (impl_->icon_->GetMainType() == type) - return *(impl_->icon_); - - if (impl_->text_->GetMainType() == type) - return *(impl_->text_); - - return FactoryManager::GetInst().GetNullItem(); -} - -bool IconTextItem::IsItemTypeExist(int type) { - if (GetType() == type) - return true; - return false; -} - -IconItem& IconTextItem::GetIconItem() const { - return *(impl_->icon_); -} - -TextItem& IconTextItem::GetTextItem() const { - return *(impl_->text_); -} - -IconTextItem::~IconTextItem() = default; -IconTextItem::Impl::~Impl() = default; - -} // namespace item -} // namespace notification diff --git a/notification-ex/icon_text_item.h b/notification-ex/icon_text_item.h deleted file mode 100644 index 224aa637..00000000 --- a/notification-ex/icon_text_item.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ - -#ifndef NOTIFICATION_EX_ICON_TEXT_ITEM_H_ -#define NOTIFICATION_EX_ICON_TEXT_ITEM_H_ - -#include -#include -#include - -#include "notification-ex/abstract_item.h" -#include "notification-ex/icon_item.h" -#include "notification-ex/text_item.h" - -namespace notification { -namespace item { - -/** - * @brief The class for IconTextItem type notification. - * @details The class to make the notification with icon and text. - * @since_tizen 5.5 - */ -class EXPORT_API IconTextItem : public AbstractItem { - public: - /** - * @brief Constructor - * @since_tizen 5.5 - * @param[in] id The IconTextItem id - * @param[in] icon The icon of IconTextItem - * @param[in] text The text of IconTextItem - * @param[in] action The action for IconTextItem - */ - IconTextItem(std::string id, std::shared_ptr icon, - std::shared_ptr text, - std::shared_ptr action = std::shared_ptr({})); - - /** - * @brief Destructor - * @since_tizen 5.5 - */ - virtual ~IconTextItem(); - - /** - * @brief Serialize the data of IconTextItem. - * @since_tizen 5.5 - * @return Bundle type data - */ - tizen_base::Bundle Serialize() const override; - - /** - * @brief Deserialize the serialized data. - * @since_tizen 5.5 - * @param[in] b The serialized Bundle data - */ - void Deserialize(tizen_base::Bundle b) override; - - /** - * @brief Finds the AbstractItem using by notification item id. - * @since_tizen 5.5 - * @param[in] id notification item id - * @return AbstractItem object - */ - AbstractItem& FindByID(std::string id) override; - - /** - * @brief Finds the AbstractItem using by main type. - * @since_tizen 5.5 - * @param[in] type The main type - * @return AbstractItem object - */ - AbstractItem& FindByMainType(MainType type) override; - - /** - * @brief Checks the item type exist in this notification. - * @since_tizen 5.5 - * @param[in] type notification item type - * @return true if the item type exists - */ - bool IsItemTypeExist(int type) override; - - /** - * @brief Gets the type of IconTextItem. - * @since_tizen 5.5 - * @return AbstractItem::Type::IconText - */ - int GetType() const override; - - /** - * @brief Gets the IconItem of IconTextItem. - * @since_tizen 5.5 - * @return The IconItem object - */ - IconItem& GetIconItem() const; - - /** - * @brief Gets the TextItem of IconTextItem. - * @since_tizen 5.5 - * @return The TextItem object - */ - TextItem& GetTextItem() const; - - private: - class Impl; - std::unique_ptr impl_; -}; // class IconTextItem - -} // namespace item -} // namespace notification -#endif // NOTIFICATION_EX_ICON_TEXT_ITEM_H_ diff --git a/notification-ex/icon_text_item_implementation.h b/notification-ex/icon_text_item_implementation.h deleted file mode 100644 index 7c745128..00000000 --- a/notification-ex/icon_text_item_implementation.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - */ - -#ifndef NOTIFICATION_EX_ICON_TEXT_ITEM_IMPLEMENTATION_H_ -#define NOTIFICATION_EX_ICON_TEXT_ITEM_IMPLEMENTATION_H_ - -#include -#include -#include - -#include "notification-ex/icon_text_item.h" - -namespace notification { -namespace item { - -class IconTextItem::Impl { - public: - virtual ~Impl(); - - private: - friend class IconTextItem; - Impl(IconTextItem* parent, std::shared_ptr icon, - std::shared_ptr text); - - private: - IconTextItem* parent_; - std::shared_ptr icon_; - std::shared_ptr text_; -}; - -} // namespace item -} // namespace notification -#endif // NOTIFICATION_EX_ICON_TEXT_ITEM_IMPLEMENTATION_H_ diff --git a/unittest/src/test_icon_text_item.cc b/unittest/src/test_icon_text_item.cc deleted file mode 100644 index 0a296229..00000000 --- a/unittest/src/test_icon_text_item.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 -#include - -#include "notification-ex/icon_text_item.h" -#include "notification-ex/item_inflator.h" - -using namespace tizen_base; -using namespace notification; -using namespace notification::item; - -class IconTextItemTest : public ::testing::Test { - public: - IconTextItem* item; - std::string id = "icontext_id"; - virtual void SetUp() { - item = new IconTextItem(id, - std::make_shared("icon_id", "icon_path"), - std::make_shared("text_id", "title")); - } - virtual void TearDown() { - delete item; - } -}; - -TEST_F(IconTextItemTest, create) { - EXPECT_NE(IconTextItemTest::item, nullptr); -} - -TEST_F(IconTextItemTest, FindByID) { - AbstractItem& child = IconTextItemTest::item->FindByID(IconTextItemTest::id); - IconTextItem& icontext = static_cast(child); - ASSERT_EQ(icontext.GetIconItem().GetImagePath(), "icon_path"); - ASSERT_EQ(icontext.GetTextItem().GetContents(), "title"); -} - -TEST_F(IconTextItemTest, FindByIDNullItemReturn) { - AbstractItem& child = IconTextItemTest::item->FindByID("not_existed_item"); - ASSERT_EQ(child.GetType(), IconItem::NullObject); -} - -TEST_F(IconTextItemTest, SerializeDeserialize) { - Bundle b = IconTextItemTest::item->Serialize(); - - std::shared_ptr gen_item = ItemInflator::Create(b); - auto gen_icon = std::static_pointer_cast(gen_item); - ASSERT_EQ(IconTextItemTest::item->GetIconItem().GetImagePath(), gen_icon->GetIconItem().GetImagePath()); - ASSERT_EQ(IconTextItemTest::item->GetTextItem().GetContents(), gen_icon->GetTextItem().GetContents()); -}