summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSukHyung, Kang <shine.kang@samsung.com>2019-02-27 15:02:39 +0900
committerSukHyung, Kang <shine.kang@samsung.com>2019-02-27 18:13:05 +0900
commit8e7f20a9910e830639fc08fc8b6e38bcb7bda454 (patch)
tree59635b59f2faee342426d705babda27f341c1b49
parent7ce27d9bda8cd08f1cb24606f8350ab0af4e93fd (diff)
downloadnotification-8e7f20a9910e830639fc08fc8b6e38bcb7bda454.tar.gz
notification-8e7f20a9910e830639fc08fc8b6e38bcb7bda454.tar.bz2
notification-8e7f20a9910e830639fc08fc8b6e38bcb7bda454.zip
Add parameter for hyperlink for TextItemsubmit/tizen/20190228.000028
Change-Id: I79395e017e9c3621aaaa20405892bcab9a2f5750 Signed-off-by: SukHyung, Kang <shine.kang@samsung.com>
-rw-r--r--notification-ex/item_factory.cc2
-rw-r--r--notification-ex/text_item.cc12
-rw-r--r--notification-ex/text_item.h5
-rw-r--r--notification-ex/text_item_implementation.h2
-rw-r--r--unittest/src/test_text_item.cc21
5 files changed, 20 insertions, 22 deletions
diff --git a/notification-ex/item_factory.cc b/notification-ex/item_factory.cc
index 672bc98..721c4b8 100644
--- a/notification-ex/item_factory.cc
+++ b/notification-ex/item_factory.cc
@@ -43,7 +43,7 @@ shared_ptr<AbstractItem> ItemFactory::CreateItem(AbstractItem::Type type) {
case AbstractItem::NullObject :
THROW(NOTIFICATION_ERROR_INVALID_PARAMETER);
case AbstractItem::Text :
- return make_shared<TextItem>("");
+ return make_shared<TextItem>("","");
case AbstractItem::Icon :
return make_shared<ButtonItem>("");
case AbstractItem::Image :
diff --git a/notification-ex/text_item.cc b/notification-ex/text_item.cc
index 64b0773..f01d3e0 100644
--- a/notification-ex/text_item.cc
+++ b/notification-ex/text_item.cc
@@ -32,17 +32,13 @@
namespace notification {
namespace item {
-TextItem::TextItem(std::string text, std::shared_ptr<AbstractAction> action)
- : AbstractItem(AbstractItem::Type::Text), impl_(new Impl(text)) {
-}
-
-TextItem::TextItem(std::string id, std::string text,
+TextItem::TextItem(std::string id, std::string text, std::string hyperlink,
std::shared_ptr<AbstractAction> action)
- : AbstractItem(id, AbstractItem::Type::Text), impl_(new Impl(text)) {
+ : AbstractItem(id, AbstractItem::Type::Text), impl_(new Impl(text, hyperlink)) {
}
-TextItem::Impl::Impl(std::string text)
- : text_(text) {
+TextItem::Impl::Impl(std::string text, std::string hyperlink)
+ : text_(text), hyperlink_(hyperlink) {
LOGI("TextItem created");
}
diff --git a/notification-ex/text_item.h b/notification-ex/text_item.h
index ccbf2fd..2814992 100644
--- a/notification-ex/text_item.h
+++ b/notification-ex/text_item.h
@@ -31,9 +31,8 @@ namespace item {
class EXPORT_API TextItem : public AbstractItem {
public:
- TextItem(std::string text,
- std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
- TextItem(std::string id, std::string text,
+ TextItem(std::string id ,std::string text,
+ std::string hyperlink = std::string(),
std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
virtual ~TextItem();
diff --git a/notification-ex/text_item_implementation.h b/notification-ex/text_item_implementation.h
index 3af64c2..48eb92b 100644
--- a/notification-ex/text_item_implementation.h
+++ b/notification-ex/text_item_implementation.h
@@ -30,7 +30,7 @@ class TextItem::Impl {
virtual ~Impl();
private:
- Impl(std::string text);
+ Impl(std::string text, std::string hyperlink);
private:
friend class TextItem;
diff --git a/unittest/src/test_text_item.cc b/unittest/src/test_text_item.cc
index 9bef5f2..316e2cd 100644
--- a/unittest/src/test_text_item.cc
+++ b/unittest/src/test_text_item.cc
@@ -33,22 +33,22 @@ class TexttItemTest : public ::testing::Test {
};
TEST_F(TexttItemTest, FindByID) {
- TextItem item("text_id", "default");
+ TextItem item("text_id", "contents", "hyperlink");
AbstractItem& child = item.FindByID("text_id");
TextItem& btn = static_cast<TextItem&>(child);
- ASSERT_EQ(btn.GetContents(), "default");
+ ASSERT_EQ(btn.GetContents(), "contents");
}
TEST_F(TexttItemTest, FindByIDNullItemReturn) {
- TextItem item("text_id", "default");
+ TextItem item("text_id", "contents", "hyperlink");
AbstractItem& child = item.FindByID("not_existed_item");
ASSERT_EQ(child.GetType(), TextItem::NullObject);
}
TEST_F(TexttItemTest, SerializeDeserializeGetContents) {
- TextItem item("text_id", "default");
+ TextItem item("text_id", "contents");
Bundle b = item.Serialize();
ItemFactory factory;
std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(factory, b);
@@ -59,16 +59,19 @@ TEST_F(TexttItemTest, SerializeDeserializeGetContents) {
}
TEST_F(TexttItemTest, SetContentsGetContents) {
- TextItem item("text_id", "default");
- item.SetContents("test");
+ TextItem item("text_id", "contents");
+ ASSERT_EQ(item.GetContents(), "contents");
- ASSERT_EQ(item.GetContents(), "test");
+ item.SetContents("changed");
+ ASSERT_EQ(item.GetContents(), "changed");
}
TEST_F(TexttItemTest, GetHyperLink) {
- TextItem item("text_id", "default");
+ TextItem item("text_id", "contents");
+ ASSERT_TRUE(item.GetHyperLink().empty());
- ASSERT_EQ(item.GetHyperLink(), "");
+ TextItem item2("text_id", "contents", "hyperlink2");
+ ASSERT_EQ(item2.GetHyperLink(), "hyperlink2");
}
} // namespace \ No newline at end of file